Tweens in scripts
A tween changes one property of a node from its current value to a target over a duration. Scripts start tweens with the functions of aego/tween and chain options on the result.
tween.ToFloat(node, "SpriteRenderer.Tint.a", 0, 0.5, curve.Linear).Delay(1).PingPong(-1)
ToFloat,ToVec2,ToVec3,ToColorandToQuatanimate a property by its path.Positionmoves a 2D node.- The easing is a preset from
aego/curve, such ascurve.OutQuadorcurve.OutBack.Curveuses a curve field instead. - Options such as
Delay,Loop,PingPongandUnscaledgo right after the call. Completedis a signal that fires once when the tween ends.
Every function and option is listed on the aego/tween page.
Rules
- When the last leg ends, the property gets exactly the end value:
to, or the start after an even number of ping-pong legs. - A new tween on the same property of the same node stops the running one.
- A tween stops when its node, its component or its script is gone.