Class Animator
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.armature.Animator
Everything one armature-driven thing is doing: its animation layers, procedural motion, joint styles and Molang variables.
Every entity, block entity and item stack drawn with an armature has its own, made the first time it is drawn and set up
by its renderer.
animator.layer("base").drive(ctx -> ctx.moving() ? WALK : IDLE);
animator.layer("action", l -> l.mask(JointMask.of("body")));
animator.lookAt("head");
animator.spring("tail").damping(6);
animator.onEvent(event -> { if (event.effect().equals("stomp")) shakeCamera(); });
animator.hide("saddle");
Only play(Motion) and layer(String) are needed for the simplest setups: a layer named
"base" is made when first asked for, and play uses it.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe layerplay(Motion)and server commands without a layer use. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarmature()builtInEffects(boolean play) Whether sound and particle keyframes play by themselves (they do unless turned off here).context()emitter(String point, ParticleSpec spec) Effect particles pouring from a point.@Nullable AnimLayer@Nullable ArmatureFrameframe()The frame last worked out, or null before the first update.Draws a joint and its children at full brightness, whatever the light.Hides a joint and everything on it untilshow(String)n.booleanWhether any layer is playing this clip.A layer by name, made (on top of the others) if there is none yet.A layer, set up bysetuponly when it is first made.layers()Every layer, bottom first.Turns a joint toward where the entity looks (or the nearest player); made once, then the same one is returned.modify(JointModifier modifier) Runs code on the pose every frame, after the layers and head tracking.onEvent(ArmatureEvent.Listener listener) Gets every sound, particle and instruction keyframe as it plays.Plays a motion on the "base" layer.@Nullable ArmaturePosepose()The pose last worked out (what the layers, head tracking and modifiers made), or null before the first update.Carries an.objmodel on a joint or point, as well as the ones its.armature.jsongives.removeProp(ObjProp prop) setVariable(String name, double value) setVisible(String joint, boolean visible) Makes a joint swing on a spring; made once, then the same one is returned.Multiplies a joint's colour (and its children's) by an ARGB colour; white clears it.A glowing trail behind a point; made once, then the same one is returned.transition(Transition transition) How animations blend into each other on layers that set no transition of their own.transitions(boolean enabled) Turns blending on or off for every layer at once: off, every change cuts.booleanupdate(double clock, float partialTick, org.joml.Matrix4fc modelToWorld) Moves everything on to a moment and poses the armature.double
-
Field Details
-
BASE
The layerplay(Motion)and server commands without a layer use.- See Also:
-
-
Constructor Details
-
Animator
-
-
Method Details
-
armature
-
context
-
layer
-
layer
-
findLayer
-
layers
-
play
-
play
-
transition
How animations blend into each other on layers that set no transition of their own. -
transitions
Turns blending on or off for every layer at once: off, every change cuts. On by default. -
transitionsEnabled
public boolean transitionsEnabled() -
stop
-
isPlaying
Whether any layer is playing this clip. -
lookAt
-
spring
-
prop
-
removeProp
-
trail
A glowing trail behind a point; made once, then the same one is returned. -
emitter
Effect particles pouring from a point. Several can share a point. -
modify
Runs code on the pose every frame, after the layers and head tracking. -
onEvent
Gets every sound, particle and instruction keyframe as it plays. -
builtInEffects
Whether sound and particle keyframes play by themselves (they do unless turned off here). -
hide
Hides a joint and everything on it untilshow(String)n. -
show
-
setVisible
-
tint
-
glow
-
variable
-
setVariable
-
pose
The pose last worked out (what the layers, head tracking and modifiers made), or null before the first update. -
frame
The frame last worked out, or null before the first update. -
update
Moves everything on to a moment and poses the armature. Renderers call this each frame; call it yourself only to draw an armature somewhere CoolCatLib's renderers don't reach.- Parameters:
clock- seconds on any clock that only goes forward (GameClock-like); the first call starts itmodelToWorld- from model pixels to the world, in blocks, for springs, head tracking and particles
-