SpineMontageSettings
Complete configuration for initializing a SpineMontage.
This class provides a convenient way to configure all aspects of a SpineMontage in a single object, which can be passed to the SpineMontage constructor. It combines animation definitions, default settings, Spine instance configuration, and initial state into one cohesive structure.
The @:structInit metadata enables object literal syntax for easy configuration.
Complete montage setup
enum PlayerState {
IDLE;
WALK;
RUN;
JUMP;
ATTACK;
}
var settings:SpineMontageSettings<PlayerState> = {
spine: {
data: playerSpineData,
scale: 0.5,
bound: true
},
defaults: {
track: 0,
speed: 1.0,
loop: false
},
animations: {
IDLE: { anim: "idle", loop: true },
WALK: { anim: "walk", loop: true, speed: 1.0 },
RUN: { anim: "run", loop: true, speed: 1.5 },
JUMP: {
anim: "jump",
next: IDLE,
begin: () -> playSound("jump")
},
ATTACK: {
anim: "sword_swing",
next: IDLE,
complete: () -> dealDamage()
}
},
start: Idle
};
var montage = new SpineMontage(settings);
Minimal setup with existing Spine instance
var settings:SpineMontageSettings<String> = {
spine: {
instance: existingSpineObject,
bound: false
},
animations: {
"intro": { anim: "intro_animation" },
"loop": { anim: "main_loop", loop: true }
}
};
Instance Members
The animation configurations that make up this montage.
This is a dynamic object where:
- Keys are string representations of your animation identifiers (T)
- Values are SpineMontageAnimation
configurations
For enum-based montages, use the enum constructor names as keys. For string-based montages, use the string values directly.
Each animation configuration defines how that particular animation should be played, including its Spine animation name, playback settings, callbacks, and transitions.
animations: {
IDLE: { anim: "idle_loop", loop: true },
WALK: { anim: "walk_cycle", loop: true, speed: 1.2 },
ATTACK: { anim: "attack_01", next: IDLE }
}
Default configuration values that apply to all animations.
These defaults reduce repetition by providing common values that animations will use unless they specify their own. Includes:
- Default track index
- Default playback speed
- Default loop behavior
- Default skin
Individual animations can override any of these defaults.
Configuration for the Spine instance used by this montage.
This can either:
- Provide an existing Spine instance to use
- Specify SpineData to create a new instance
- Configure scale, depth, and binding behavior
If not provided, you must manually set the spine instance on the montage after creation.
The initial animation to play when the montage is created.
This animation will be automatically started after the montage is fully initialized. The animation begins on the next immediate frame to ensure all setup is complete.
If null, no animation will play initially and you must call play() manually to start an animation.
start: PlayerState.IDLE // For enum-based montages
start: "intro" // For string-based montages
new(?animations: Null<Null<Dynamic>>, ?defaults: Null<Null<SpineMontageDefaults>>, ?spine: Null<Null<SpineMontageSpineSettings>>, ?start: Null<Null<ceramic.SpineMontageSettings.T>>): Void
Name | Type | Default | Description |
---|---|---|---|
animations |
Null<Null<Dynamic>> | (optional) | * The animation configurations that make up this montage. * This is a dynamic object where: - Keys are string representations of your animation identifiers (T) - Values are SpineMontageAnimationhaxe animations: { IDLE: { anim: "idle_loop", loop: true }, WALK: { anim: "walk_cycle", loop: true, speed: 1.2 }, ATTACK: { anim: "attack_01", next: IDLE } } |
defaults |
Null<Null<SpineMontageDefaults>> | (optional) | * Default configuration values that apply to all animations. * These defaults reduce repetition by providing common values that animations will use unless they specify their own. Includes: - Default track index - Default playback speed - Default loop behavior - Default skin * Individual animations can override any of these defaults. |
spine |
Null<Null<SpineMontageSpineSettings>> | (optional) | * Configuration for the Spine instance used by this montage. * This can either: - Provide an existing Spine instance to use - Specify SpineData to create a new instance - Configure scale, depth, and binding behavior * If not provided, you must manually set the spine instance on the montage after creation. |
start |
Null<Null<ceramic.SpineMontageSettings.T>> | (optional) | * The initial animation to play when the montage is created. * This animation will be automatically started after the montage is fully initialized. The animation begins on the next immediate frame to ensure all setup is complete. * If null, no animation will play initially and you must call play() manually to start an animation. * haxe start: PlayerState.IDLE // For enum-based montages start: "intro" // For string-based montages |
Metadata
Name | Parameters |
---|---|
:structInit |
- |