-
Notifications
You must be signed in to change notification settings - Fork 0
Core Concepts: EffectClips, Layers, and Bindings
An EffectClip is the central component that brings a Timeline (the "what to animate") and an Effect (the "how to render") together. It's the primary Playable unit that you give to the AnimationEngine.
An EffectClip is created using its builder and configures three main things:
- The Timeline: Which timeline will drive this animation.
- The Layers: One or more visual effect layers.
- The Bindings: How the timeline's properties connect to the layers.
An EffectClip can have multiple layers. This is extremely useful for creating complex effects that share the same master timeline. For example, a spell effect could have:
- A main expanding sphere on one layer.
- Swirling particles on a second layer.
- A ground-crack decal on a third layer.
All these layers will be perfectly synchronized because they are driven by the same timeline playback instance.
EffectClip complexSpell = EffectClip.builder()
.timeline(myTimeline)
// Layer 1: The main sphere
.layer(layer -> layer.effect(new SphereEffect(...)))
// Layer 2: Swirling particles
.layer(layer -> layer.effect(new SwirlEffect(...)))
.build();The .bindings() method is where you connect the TimelineProperty values from your timeline to the @AnimatedProperty fields of your Effect.
-
bindParameter("fieldName", timelineProperty): This is the most common binding. It takes the value fromtimelinePropertyand injects it into the field named"fieldName"on yourAnimatedEffectinstance.
Bindings can be applied at the root level (.rootBindings()) to affect all layers, or at the layer level to be specific to that layer.