← back to roto on ba3a.dev

AseModelSource

class AseModelSource(file: Path, canvas: Canvas, defaultLoop: Boolean) : ModelSource

An .ase or .aseprite file as animations. Each frame is its visible layers composited cel by cel (cel position, layer and cel opacity, palette colour), durations come from the file. Each tag becomes one row; a file without tags gives one row of all its frames. A tag sets the loop flag (repeating forever loops); without a tag the artist's defaultLoop applies. A file outside the supported subset fails with the AseFormatException as it is.

Parameters

file

the .ase file

canvas

the project canvas; the sprite must fit in it, and a smaller one is placed by ModelCanvas

defaultLoop

the artist's loop choice for a file without tags

Constructors

Link copied to clipboard
constructor(file: Path, canvas: Canvas, defaultLoop: Boolean)

Functions

Link copied to clipboard
open override fun durations(row: ModelRow): List<Int>

The file's frame durations for row.

Link copied to clipboard
open override fun frames(row: ModelRow): List<Raster>

The frames of row, each composited at sprite size and placed on the canvas.

Link copied to clipboard
open override fun loop(row: ModelRow): Boolean

The tag's loop flag, or the artist's choice for an untagged file.

Link copied to clipboard
open override fun rows(): List<ModelRow>

One row per tag, or one for the whole file.