PokéRogue
    Preparing search index...

    A Frame is a section of a Texture. It defines a rectangular sub-region within a Texture Source, storing its position, dimensions, UV coordinates, and optional trim data (for packed atlas frames with whitespace removed). Frames are the primary unit of texture addressing used by Game Objects -- when a Sprite displays a particular image, it references a Frame.

    Index
    • Parameters

      • texture: 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

    autoRound: number

    Overrides 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 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: 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.

    • Clones this Frame into a new Frame object.undefined

      Returns Frame

      A clone of this Frame.

    • Destroys this Frame by nulling its reference to the parent Texture 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 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

      The updated crop data 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

      This Frame object.

    • 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

      This Frame object.

    • 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 of the center scale9 rectangle.

      Returns this

      This Frame object.

    • 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

      This Frame object.

    • 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

      This Frame object.

    • 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

      This Frame object.

    • 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

      The updated crop data object.

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

      Returns this

      This Frame object.

    • Updates the internal WebGL UV cache for a rotated frame, swapping the width and height axes so that the UV coordinates map correctly to a frame that has been rotated 90 degrees in the texture atlas.undefined

      Returns this

      This Frame object.