phaser - v4.0.0-rc.4
    Preparing search index...

    A Frame is a section of a Texture.

    Index

    Constructors

    • Parameters

      • texture: Textures.Texture

        The Texture this Frame is a part of.

      • name: string | number

        The name of this Frame. The name is unique within the Texture.

      • sourceIndex: number

        The index of the TextureSource that this Frame is a part of.

      • x: number

        The x coordinate of the top-left of this Frame.

      • y: number

        The y coordinate of the top-left of this Frame.

      • width: number

        The width of this Frame.

      • height: number

        The height of this Frame.

      Returns Frame

    Properties

    autoRound: number

    Over-rides the Renderer setting. -1 = use Renderer Setting 0 = No rounding 1 = Round

    canvasData: object

    The Canvas drawImage data object.

    centerX: number

    The x center of this frame, floored.

    centerY: number

    The y center of this frame, floored.

    customData: object

    Any Frame specific custom data can be stored here.

    customPivot: boolean

    Does this Frame have a custom pivot point?

    cutHeight: number

    The height of the area in the source image to cut.

    cutWidth: number

    The width of the area in the source image to cut.

    cutX: number

    X position within the source image to cut from.

    cutY: number

    Y position within the source image to cut from.

    A reference to the Texture Source WebGL Texture that this Frame is using.

    halfHeight: number

    Half the height, floored. Precalculated for the renderer.

    halfWidth: number

    Half the width, floored. Precalculated for the renderer.

    height: number

    The rendering height of this Frame, taking trim into account.

    is3Slice: boolean

    If the Frame has scale9 border data, is it 3-slice or 9-slice data?

    name: string

    The name of this Frame. The name is unique within the Texture.

    pivotX: number

    The horizontal pivot point of this Frame.

    pivotY: number

    The vertical pivot point of this Frame.

    radius: number

    The radius of the Frame (derived from sqrt(w * w + h * h) / 2)

    realHeight: number

    The height of the Frame in its un-trimmed, un-padded state, as prepared in the art package, before being packed.

    realWidth: number

    The width of the Frame in its un-trimmed, un-padded state, as prepared in the art package, before being packed.

    rotated: boolean

    CURRENTLY UNSUPPORTED

    Is this frame is rotated or not in the Texture? Rotation allows you to use rotated frames in texture atlas packing. It has nothing to do with Sprite rotation.

    scale9: boolean

    Does the Frame have scale9 border data?

    The TextureSource this Frame is part of.

    sourceIndex: number

    The index of the TextureSource in the Texture sources array.

    texture: Textures.Texture

    The Texture this Frame is a part of.

    trimmed: boolean

    Is the Frame trimmed or not?

    u0: number

    WebGL UV u0 value.

    u1: number

    WebGL UV u1 value.

    v0: number

    WebGL UV v0 value.

    v1: number

    WebGL UV v1 value.

    width: number

    The rendering width of this Frame, taking trim into account.

    x: number

    The X rendering offset of this Frame, taking trim into account.

    y: number

    The Y rendering offset of this Frame, taking trim into account.

    Methods

    • Destroys this Frame by nulling its reference to the parent Texture and and data objects.

      Returns void

    • Takes a crop data object and, based on the rectangular region given, calculates the required UV coordinates in order to crop this Frame for WebGL and Canvas rendering.

      The crop size as well as coordinates can not exceed the the size of the frame.

      This is called directly by the Game Object Texture Components setCrop method. Please use that method to crop a Game Object.

      Parameters

      • crop: object

        The crop data object. This is the GameObject._crop property.

      • x: number

        The x coordinate to start the crop from. Cannot be negative or exceed the Frame width.

      • y: number

        The y coordinate to start the crop from. Cannot be negative or exceed the Frame height.

      • width: number

        The width of the crop rectangle. Cannot exceed the Frame width.

      • height: number

        The height of the crop rectangle. Cannot exceed the Frame height.

      • flipX: boolean

        Does the parent Game Object have flipX set?

      • flipY: boolean

        Does the parent Game Object have flipY set?

      Returns object

    • Sets the x and y position within the source image to cut from.

      Parameters

      • Optionalx: number

        X position within the source image to cut from. Default 0.

      • Optionaly: number

        Y position within the source image to cut from. Default 0.

      Returns this

    • Sets the width, and height of the area in the source image to cut.

      Parameters

      • width: number

        The width of the area in the source image to cut.

      • height: number

        The height of the area in the source image to cut.

      Returns this

    • Sets the scale9 center rectangle values.

      Scale9 is a feature of Texture Packer, allowing you to define a nine-slice scaling grid.

      This is set automatically by the JSONArray and JSONHash parsers.

      Parameters

      • x: number

        The left coordinate of the center scale9 rectangle.

      • y: number

        The top coordinate of the center scale9 rectangle.

      • width: number

        The width of the center scale9 rectangle.

      • height: number

        The height coordinate of the center scale9 rectangle.

      Returns this

    • Sets the width, height, x and y of this Frame.

      This is called automatically by the constructor and should rarely be changed on-the-fly.

      Parameters

      • width: number

        The width of the frame before being trimmed.

      • height: number

        The height of the frame before being trimmed.

      • Optionalx: number

        The x coordinate of the top-left of this Frame. Default 0.

      • Optionaly: number

        The y coordinate of the top-left of this Frame. Default 0.

      Returns this

    • If the frame was trimmed when added to the Texture Atlas, this records the trim and source data.

      Parameters

      • actualWidth: number

        The width of the frame before being trimmed.

      • actualHeight: number

        The height of the frame before being trimmed.

      • destX: number

        The destination X position of the trimmed frame for display.

      • destY: number

        The destination Y position of the trimmed frame for display.

      • destWidth: number

        The destination width of the trimmed frame for display.

      • destHeight: number

        The destination height of the trimmed frame for display.

      Returns this

    • Directly sets the canvas and WebGL UV data for this frame.

      Use this if you need to override the values that are generated automatically when the Frame is created.

      Parameters

      • width: number

        Width of this frame for the Canvas data.

      • height: number

        Height of this frame for the Canvas data.

      • u0: number

        UV u0 value.

      • v0: number

        UV v0 value.

      • u1: number

        UV u1 value.

      • v1: number

        UV v1 value.

      Returns this

    • Takes a crop data object and recalculates the UVs based on the dimensions inside the crop object. Called automatically by setFrame.

      Parameters

      • crop: object

        The crop data object. This is the GameObject._crop property.

      • flipX: boolean

        Does the parent Game Object have flipX set?

      • flipY: boolean

        Does the parent Game Object have flipY set?

      Returns object

    • Updates the internal WebGL UV cache and the drawImage cache.

      Returns this