SpritePlugin

ceramic.SpritePlugin (Class)

Plugin that adds sprite sheet and animation support to Ceramic.

Provides:

  • SpriteAsset loading for various sprite sheet formats
  • Sprite visual for animated sprites
  • SpriteSystem for automatic sprite updates
  • Asset extensions for easy sprite access

Supported formats:

  • Aseprite JSON exports (.sprite files)
  • Native Aseprite files (.ase, .aseprite) when ase plugin is enabled

This plugin is automatically initialized when included in the project.

Static Members

sprite
addSprite(assets: Assets, name: String, ?variant: String, ?options: Null<AssetOptions>): Void

Add a sprite asset to the assets list for loading.

Name Type Default Description
assets Assets The assets instance to add to
name String The sprite asset name (without 'sprite:' prefix)
variant String (optional) Optional variant name
options Null<AssetOptions> (optional) Loading options

sprite
ensureSprite(assets: Assets, name: Either<String, AssetId<String>>, ?variant: String, ?options: Null<AssetOptions>, done: Function): Void

Ensure a sprite asset is loaded, loading it if necessary.

Name Type Default Description
assets Assets The assets instance
name Either<String, AssetId<String>> The sprite asset name or AssetId
variant String (optional) Optional variant name
options Null<AssetOptions> (optional) Loading options
done Function Callback with the loaded SpriteAsset

sprite
sheet(assets: Assets, name: Either<String, AssetId<String>>, ?variant: String): SpriteSheet

Get a loaded sprite sheet by name.

Name Type Default Description
assets Assets The assets instance
name Either<String, AssetId<String>> The sprite asset name or AssetId
variant String (optional) Optional variant name
Returns Description
SpriteSheet The SpriteSheet if loaded, null otherwise

sprite
spriteAsset(assets: Assets, name: Either<String, AssetId<String>>, ?variant: String): SpriteAsset

Get a loaded sprite asset by name. Searches in the current assets and parent assets if not found.

Name Type Default Description
assets Assets The assets instance
name Either<String, AssetId<String>> The sprite asset name or AssetId
variant String (optional) Optional variant name
Returns Description
SpriteAsset The SpriteAsset if loaded, null otherwise

Private Members

sprite
pluginInit(): Void

Initialize the sprite plugin. Called automatically by Ceramic during app initialization. Registers asset kinds and converters for sprite support.

Metadata

Name Parameters
:access ceramic.App