aseprite-atlas
Version:
Aseprite sprite atlas parser and animator for browser and Node.js.
24 lines (23 loc) • 1.23 kB
TypeScript
import { Atlas } from '../types/Atlas';
import { Integer } from '../types/Integer';
import { Milliseconds } from '../types/Milliseconds';
/** Record and update an Atlas.Animation's state. */
export interface Animator {
/** Cel index oscillation state. This integer may fall outside of animation
bounds depending on the animation interval selected by direction. This
value should be carried over from each call unless the cel is manually
set. Any integer in [0, length - 1] is always valid. */
period: Integer;
/** Current cel exposure in milliseconds. When the fractional value meets or
exceeds the cel exposure duration, the cel is advanced according to
direction. This value should be carried over from each call with the
current time step added, and zeroed on manual cel change. */
exposure: Milliseconds;
}
export declare namespace Animator {
/** Apply the time since last frame was shown, possibly advancing the
animation period. */
function animate(period: Integer, exposure: Milliseconds, animation: Atlas.Animation): Animator;
/** @return The animation cel index. */
function index(period: Integer, cels: readonly Atlas.Cel[]): number;
}