SpineWidgetController class

Controls how the skeleton of a SpineWidget is animated and rendered.

Upon initialization of a SpineWidget the provided onInitialized callback method is called once. This method can be used to setup the initial animation(s) of the skeleton, among other things.

After initialization is complete, the SpineWidget is rendered at the screen refresh rate. In each frame, the AnimationState is updated and applied to the Skeleton.

Next the optionally provided method onBeforeUpdateWorldTransforms is called, which can modify the skeleton before its current pose is calculated using Skeleton.updateWorldTransforms. After Skeleton.updateWorldTransforms has completed, the optional onAfterUpdateWorldTransforms method is called, which can modify the current pose before rendering the skeleton.

Before the skeleton's current pose is rendered by the SpineWidget the optional onBeforePaint is called, which allows rendering backgrounds or other objects that should go behind the skeleton on the Canvas. The SpineWidget then renderes the skeleton's current pose, and finally calls the optional onAfterPaint, which can render additional objects on top of the skeleton.

The underlying Atlas, SkeletonData, Skeleton, AnimationStateData, AnimationState, and SkeletonDrawable can be accessed through their respective getters to inspect and/or modify the skeleton and its associated data. Accessing this data is only allowed if the SpineWidget and its data have been initialized and have not been disposed yet.

By default, the widget updates and renders the skeleton every frame. The pause method can be used to pause updating and rendering the skeleton. The resume method resumes updating and rendering the skeleton. The isPlaying getter reports the current state.

Constructors

SpineWidgetController({void onInitialized(SpineWidgetController controller)?, void onBeforeUpdateWorldTransforms(SpineWidgetController controller)?, void onAfterUpdateWorldTransforms(SpineWidgetController controller)?, void onBeforePaint(SpineWidgetController controller, Canvas canvas)?, void onAfterPaint(SpineWidgetController controller, Canvas canvas, List<RenderCommand> commands)?})
Constructs a new SpineWidget controller. See the class documentation of SpineWidgetController for information on the optional arguments.

Properties

animationState AnimationState
The AnimationState used to manage animations that are being applied to the skeleton.
no setter
animationStateData AnimationStateData
The mixing information used by the AnimationState
no setter
atlas Atlas
The Atlas from which images to render the skeleton are sourced.
no setter
drawable SkeletonDrawable
The SkeletonDrawable
no setter
hashCode int
The hash code for this object.
no setterinherited
isPlaying bool
no setter
onAfterPaint → void Function(SpineWidgetController controller, Canvas canvas, List<RenderCommand> commands)?
final
onAfterUpdateWorldTransforms → void Function(SpineWidgetController controller)?
final
onBeforePaint → void Function(SpineWidgetController controller, Canvas canvas)?
final
onBeforeUpdateWorldTransforms → void Function(SpineWidgetController controller)?
final
onInitialized → void Function(SpineWidgetController controller)?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skeleton Skeleton
The Skeleton
no setter
skeletonData SkeletonData
The setup-pose data used by the skeleton.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pause() → void
Pauses updating and rendering the skeleton.
resume() → void
Resumes updating and rendering the skeleton.
toSkeletonCoordinates(Offset position) Offset
Transforms the coordinates given in the SpineWidget coordinate system in position to the skeleton coordinate system. See the ik_following.dart example how to use this to move a bone based on user touch input.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited