Animate wraps Godot Tweens behind a small option-based API you can call from
anywhere. It handles delays, easing, "from/to" values, arrays of objects, and an
onFinished callback for you.
See also Motion for continuous, sampleable idle motion (the
Tween vs Motion split: Animate for punctual A β B moves, Motion for
forever-looping juice), and Framer for sprite-frame animation.
Most functions take (object, options) where options is a dictionary:
| key | default | description |
|---|---|---|
propertyPath |
β | property to animate, dotted (e.g. position, modulate:a, scale) |
toValue |
current | target value |
fromValue |
current | start value (set before animating) |
duration |
0.75 |
seconds |
delay |
0 |
seconds before starting |
transition |
engine default | Tween.TRANS_* |
easing |
engine default | Tween.EASE_* |
onFinished |
β | callback when the tween ends |
delayBetweenElements |
0 |
when animating an array, stagger between items |
signalToWait |
animationDone |
user signal emitted on completion |
Animate.to(objectOrArray, options)β animate towardtoValue. Accepts an array to animate many nodes (optionally staggered).Animate.from(object, options)β setfromValuethen animate back to the current value.Animate.toAndBack(object, options)β animate totoValuethen back.
Animate.to(yourObject, {
propertyPath = 'position',
toValue = Vector2(200, 200),
duration = 0.5,
easing = Tween.EASE_IN_OUT,
delay = 0.3
})Animating several nodes with a delay between each, then logging:
Animate.to([potion, car, book], {
propertyPath = "position",
toValue = Vector2(0, 0),
delayBetweenElements = 1,
onFinished = func(): G.log('DONE')
})Fade helpers driving modulate:a and visible:
Animate.show(object, duration = 0.3, delay = 0.0, doNotHide = false)Animate.hide(object, duration = 0.3, delay = 0)β setsvisible = falsewhen done
Animate.show(car)
await Wait.forSomeTime(car, 2).timeout
Animate.to(car, {propertyPath = 'position', toValue = Vector2(200, 200)})Animate.flash(object, options)β quick brightness flash (modulate:v),durationdefault0.2.Animate.bounce(object, options)β scale pop;upScale(default0.05) andduration(default0.25). Safe to spam: it tracks the base scale so repeated calls do not grow the node.Animate.swing(object, options)β loops back-and-forth betweenfromValueandtoValue(orfromValue * ratio) until the object is freed.Animate.zoomIn(objectOrArray, options)β scale up fromfromScaleRatio(default0.9) to the current scale.Animate.collect(object, options)β "collectible" effect: spread items on a circle then gather them towardtoPositionwhile fading/shrinking; frees the object at the end. Options includefromPosition,toPosition,myNum,nbCollectables,gatherDurationSec,spreadRadius,onFinished.
Animate.bounce(button)
Animate.flash(coin, {duration = 0.15})
Animate.appear()andAnimate.disappear()exist but are tuned for a specific game (Lockey Land) β prefershow/hide/zoomInfor general use.
framer.gd (fox/animations/framer.gd) tweens a sprite's frame property to
play a spritesheet animation. Attach it as a child of an AnimatedSprite-style
node (it animates its parent's frame):
@onready var framer = $framer
func walk():
framer.animateFrames(0, 8) # play frames 0 β 8animateFrames(fromFrame, toFrame, reverse = false, maxNbFrames = 0, totalDuration = 0.3, duration = null)
also supports looping spritesheets: pass maxNbFrames so it wraps around the end
of the sheet (e.g. 30 β 2 plays 30 β 31 β 0 β 1 β 2).