Base class for all frame types

Static methods

@:value({ warn : true })staticsort(frames:Array<FlxFrame>, prefixLength:Int, suffixLength:Int, warn:Bool = true):Void

Sorts frames based on the value of the frames' name between the prefix and suffix. Uses Std.parseInt to parse the value, if the result is null, 0 is used, if the result is a negative number, the absolute valute is used.

Parameters:

frames

The list of frames to sort

prefix

Everything in the frames' name before the order

suffix

Everything in the frames' name after the order

warn

Whether to warn on invalid names

staticsortByName(frame1:FlxFrame, frame2:FlxFrame, prefixLength:Int, suffixLength:Int):Int

@:value({ warn : true })staticinlinesortFrames(frames:Array<FlxFrame>, prefix:String, ?suffix:String, warn:Bool = true):Void

Sorts frames based on the value of the frames' name between the prefix and suffix. Uses Std.parseInt to parse the value, if the result is null, 0 is used, if the result is a negative number, the absolute valute is used.

Parameters:

frames

The list of frames to sort

prefix

Everything in the frames' name before the order

suffix

Everything in the frames' name after the order

warn

Whether to warn on invalid names

Variables

angle:FlxFrameAngle

Rotation angle of this frame. Required for packed atlas images.

duration:Float

The duration of this frame in seconds. If 0, the anim controller will decide the duration

frame:FlxRect

Region of the image to render.

read onlyoffset:FlxPoint

Frame offset from top left corner of original image.

read onlysourceSize:FlxPoint

Original (uncropped) image size.

type:FlxFrameType

The type of this frame.

uv:FlxRect

UV coordinates for this frame. WARNING: For optimization purposes, width and height of this rect contain right and bottom coordinates (x + width and y + height).

Methods

clipTo(clip:FlxRect, ?clippedFrame:FlxFrame):FlxFrame

Frame clipping

Parameters:

clip

Clipping rectangle to apply on frame

clippedFrame

The frame which will contain result of original frame clipping. If null, a new frame will be created.

Returns:

Result of applying frame clipping

copyTo(?clone:FlxFrame):FlxFrame

Copies data from this frame into specified frame.

Parameters:

clone

Frame to fill data with. If null, a new frame will be created.

Returns:

Frame with data of this frame.

@:value({ disposeIfNotEqual : false, mergeAlpha : false })paint(?bmd:BitmapData, ?point:Null<Point>, mergeAlpha:Bool = false, disposeIfNotEqual:Bool = false):BitmapData

Draws frame on specified BitmapData object.

Parameters:

bmd

BitmapData object to draw this frame on. If bmd is null then new a BitmapData is created.

point

Where to draw this frame on the specified BitmapData object.

mergeAlpha

Whether to merge alphas or not. (works like with BitmapData's copyPixels() method).

disposeIfNotEqual

Whether dispose passed bmd or not if its size isn't equal to frame's original size (sourceSize)

Returns:

Modified or newly created BitmapData with frame image on it.

@:value({ disposeIfNotEqual : false, mergeAlpha : false, flipY : false, flipX : false, rotation : FlxFrameAngle.ANGLE_0 })paintRotatedAndFlipped(?bmd:BitmapData, ?point:Null<Point>, rotation:FlxFrameAngle = FlxFrameAngle.ANGLE_0, flipX:Bool = false, flipY:Bool = false, mergeAlpha:Bool = false, disposeIfNotEqual:Bool = false):BitmapData

Draws rotated and flipped frame on specified BitmapData object.

Parameters:

bmd

BitmapData object to draw this frame on. If bmd is null then new BitmapData created.

point

Where to draw this frame on the specified BitmapData object

rotation

How much rotate the frame.

flipX

Do we need to flip frame horizontally.

flipY

Do we need to flip frame vertically.

mergeAlpha

Whether to merge alphas or not (works like with BitmapData's copyPixels() method).

disposeIfNotEqual

Whether dispose passed bmd or not if its size isn't equal to frame's original size (sourceSize)

Returns:

Modified or newly created BitmapData with frame image on it.

@:value({ flipY : false, flipX : false, rotation : FlxFrameAngle.ANGLE_0 })prepareMatrix(mat:FlxMatrix, rotation:FlxFrameAngle = FlxFrameAngle.ANGLE_0, flipX:Bool = false, flipY:Bool = false):FlxMatrix

Prepares matrix for frame tile/triangles rendering.

Parameters:

mat

Matrix to transform/prepare

rotation

Rotation to apply to specified matrix.

flipX

Do we need to flip frame horizontally

flipY

Do we need to flip frame vertically

Returns:

Transformed matrix which can be used for frame drawing.

setBorderTo(border:FlxPoint, ?frameToFill:FlxFrame):FlxFrame

Just a helper method for some frame adjusting. Try to not use it, since it may cause memory leaks.

Parameters:

border

Amount to clip from frame

Returns:

Clipped frame

subFrameTo(rect:FlxRect, ?frameToFill:FlxFrame):FlxFrame

Generates frame with specified subregion of this frame.

Parameters:

rect

Frame region to generate frame for.

frameToFill

Frame to fill with data. If null then a new frame will be created.

Returns:

Specified frameToFill object but filled with data.