Collection of helpers that deal with Aseprite files. Namely the json files exported for sprite sheets.

Static methods

staticinlineaddAseAtlasTagsByIndex(sprite:FlxSprite, data:FlxAsepriteJsonAsset, ?excludeTags:Array<String>):FlxSprite

Loops through the given ase atlas's tags and adds animations for each, to the given sprite. Uses the tag's to and from fields to determine.

Warning: It's important to disable the "Ignore Empty" option if you have empty frames (that is, empty on every layer) in tags, while it will reduce the size of your json, this method will not be able to add those empty frames to an animation.

Parameters:

sprite

The sprite to add the animations

data

Can be an AseAtlas struct, a JSON string matching the AseAtlas or a string asset path to a json

excludeTags

A list of tags to ignore

Returns:

The FlxSprite instance (nice for chaining stuff together, if you're into that).

Available since

5.4.0

.

See also:

  • flixel.graphics.FlxAsepriteUtil.AseAtlasMeta

@:value({ tagSuffix : ":" })staticinlineaddAseAtlasTagsByPrefix(sprite:FlxSprite, data:FlxAsepriteJsonAsset, tagSuffix:String = ", excludeTags:Array<String> = "):FlxSprite

Loops through the given ase atlas's tags and adds animations for each, to the given sprite. Uses the frame names to determine which tag they belong to.

Notes: Assumes that the frame names are prefixed by tag name, assumes that the tagSuffix does not appear anywhere in the tag name and assumes that no tags overlap. You can use the filename format {outertag}:{frame} for most cases.

It's recommended to disable the "Ignore Empty" option if you have empty frames (that is, empty on every layer), while it will reduce the size of your json, this method will not be able to add those empty frames to an animation.

Parameters:

sprite

The sprite to add the animations

data

Can be an AseAtlas struct, a JSON string matching the AseAtlas or a string asset path to a json

tagSuffix

The delimeter on each frame name between the animation name and the frame number. Be sure to set your filename format to {outertag}:{frame}

excludeTags

A list of tags to ignore

Returns:

The FlxSprite instance (nice for chaining stuff together, if you're into that).

Available since

5.4.0

.

See also:

  • flixel.graphics.FlxAsepriteUtil.AseAtlasMeta

staticinlineloadAseAtlas(sprite:FlxSprite, graphic:FlxGraphicAsset, data:FlxAsepriteJsonAsset):FlxSprite

Helper for parsing Aseprite atlas json files. Reads frames via FlxAtlasFrames.fromAseprite.

Parameters:

sprite

The sprite to load the ase atlas's frames

graphic

The png file associated with the atlas

data

Can be an AseAtlas struct, a JSON string matching the AseAtlas or a string asset path to a json

Returns:

The FlxSprite instance (nice for chaining stuff together, if you're into that).

Available since

5.4.0

.

See also:

  • flixel.graphics.FlxAsepriteUtil.AseAtlasMeta

staticinlineloadAseAtlasAndTagsByIndex(sprite:FlxSprite, graphic:FlxGraphicAsset, data:FlxAsepriteJsonAsset, ?excludeTags:Array<String>):FlxSprite

Helper for parsing Aseprite atlas json files. Reads frame data via loadAseAtlas, then, adds animations for any tags listed, via addAseAtlasTagsByIndex.

Warning: It's important to disable the "Ignore Empty" option if you have empty frames (that is, empty on every layer) in tags, while it will reduce the size of your json, this method will not be able to add those empty frames to an animation.

Parameters:

sprite

The sprite to load the ase atlas's frames

graphic

The png file associated with the atlas

data

Can be an AseAtlas struct, a JSON string matching the AseAtlas or a string asset path to a json

excludeTags

A list of tags to ignore

Returns:

The FlxSprite instance (nice for chaining stuff together, if you're into that).

Available since

5.4.0

.

See also:

  • flixel.graphics.FlxAsepriteUtil.AseAtlasMeta

@:value({ tagSuffix : ":" })staticinlineloadAseAtlasAndTagsByPrefix(sprite:FlxSprite, graphic:FlxGraphicAsset, data:FlxAsepriteJsonAsset, tagSuffix:String = ", excludeTags:Array<String> = "):FlxSprite

Helper for parsing Aseprite atlas json files. Reads frame data via loadAseAtlas, then, adds animations for any tags listed, via addAseAtlasTagsByPrefix.

Notes: Assumes that the frame names are prefixed by tag name, assumes that the tagSuffix does not appear anywhere in the tag name and assumes that no tags overlap. You can use the filename format {outertag}:{frame} for most cases.

It's recommended to disable the "Ignore Empty" option if you have empty frames (that is, empty on every layer), while it will reduce the size of your json, this method will not be able to add those empty frames to an animation

Parameters:

sprite

The sprite to load the ase atlas's frames

graphic

The png file associated with the atlas

data

Can be an AseAtlas struct, a JSON string matching the AseAtlas or a string asset path to a json

tagSuffix

The delimeter on each frame name between the animation name and the frame number. Be sure to set your filename format to {outertag}:{frame}

excludeTags

A list of tags to ignore

Returns:

The FlxSprite instance (nice for chaining stuff together, if you're into that).

Available since

5.4.0

.

See also:

  • flixel.graphics.FlxAsepriteUtil.AseAtlasMeta