← back to roto on ba3a.dev

PngFolderModelSource

class PngFolderModelSource(folder: Path, canvas: Canvas, defaultDurationMs: Int, defaultLoop: Boolean) : ModelSource

A folder of PNG frames, sorted by file name, as one animation. A clip.json beside them (Roto's own ClipManifest) gives each frame's duration and the loop flag; without one every frame lasts defaultDurationMs and the loop flag is defaultLoop. A published clip folder works as it is.

Parameters

folder

the folder holding the PNGs

canvas

the project canvas; every frame must fit in it

defaultDurationMs

the artist's one duration for all frames when there is no clip.json

defaultLoop

the artist's loop choice when there is no clip.json

Constructors

Link copied to clipboard
constructor(folder: Path, canvas: Canvas, defaultDurationMs: Int, defaultLoop: Boolean)

Functions

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

The manifest's durations, or the artist's one duration for every frame.

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

The PNGs in name order, each placed on the canvas by ModelCanvas; one larger than the canvas stops the import.

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

The manifest's loop flag, or the artist's choice.

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

One row: the folder, its name read as <action>_<facing> when it does. A clip.json that disagrees with the PNGs fails here.