C#Beta
Definitions
A property definition is an immutable description of one motion: a readonly record struct nested in the Tweens class, one per property. Vary a copy with with; reusable definitions shows the pattern. Keyframes define several parallel value curves in one reusable object.
var arrive = new Tweens.Position2D((400, 180), 0.6, Out.Cubic); // Constructorvar pulse = new Tweens.Scale2D(1.2, 0.2) { PingPong = true }; // Initializervar slow = arrive with { Duration = 1.2 }; // CopyConstructors
Section titled “Constructors”| Constructor | Arguments |
|---|---|
new Tweens.Position2D(to, duration, ease, delay) |
The endpoint, then optional timing; every catalog definition takes these |
new Tweens.ShaderParameter<TValue>(parameter, to, duration, ease, delay) |
The uniform name first; the instance uniform definitions take the same |
new Tweens.Property<TTarget, TValue>(getter, setter, interpolate, to, duration, ease, delay) |
The property operations first; see custom definitions |
The endpoint argument is never null. To use the property’s value at start instead, leave the arguments out and set members in an initializer: new Tweens.Position2D { Duration = 0.4 }. The endpoint page lists the tuple, array, and color forms an endpoint also accepts.
Members
Section titled “Members”Every definition has the same members, listed by role:
- Endpoints & variations:
From,To,By, and their factors and deltas. - Timing:
Duration,Delay,Offset,Repeats,PingPong, intervals, andFill. - Easing:
Ease,BlendType,Blend,Skew,Weks,EaseFunction, andCurve. - Color interpolation:
ColorSpace,AlphaMode, andColorEncoding; defaults are OKLab, premultiplied alpha, and sRGB input/output. - Callbacks:
OnAddthroughOnFinally, andSuppressCallbacksWhenTargetInvalid.
| Member | Type | Meaning |
|---|---|---|
Options |
TweenOptions |
Every timing and easing member, SuppressCallbacksWhenTargetInvalid, and the duration and delay factors, as one value |
Shared options
Section titled “Shared options”ColorSpace
Section titled “ColorSpace”Whole-color interpolation defaults to ColorSpace.Oklab; Srgb and LinearRgb select other working spaces.
AlphaMode
Section titled “AlphaMode”AlphaMode.Premultiplied is the default. Straight interpolates color coordinates and alpha independently.
ColorEncoding
Section titled “ColorEncoding”ColorEncoding.Srgb accepts ordinary Godot Colors. LinearRgb supports APIs expecting linear values. Input and output use straight alpha. See the color policy for exact endpoints and relative arithmetic.
Options value
Section titled “Options value”TweenOptions is a readonly record struct holding the members of Options. A definition’s flat members, such as Duration, read and write that same value. Assign one to several definitions, list overrides after it, or pass it to a shorthand method:
var snappy = new TweenOptions { Duration = 0.25, Ease = Out.Back };var slowPop = new Tweens.Scale2D { Options = snappy, Duration = 0.6 };sprite.TweenPosition((400, 180), 0.5, snappy);Interfaces
Section titled “Interfaces”| Member | Meaning |
|---|---|
ITweenDefinition<TTarget, TValue> |
Connects a definition to typed playback; TTarget is a class and TValue a struct |
ITweenDefinition<TTarget> |
Lets groups and Chains mix value types; contravariant in TTarget |
Copy on start
Section titled “Copy on start”- Starting snapshots the configuration. Later
withcopies never reach running playback. - Preparation and property capture happen on the first eligible update, before any positive delay.
- Delegates and the objects they capture stay shared; Godot
Curveresources are duplicated for each playback. - A
withcopy allocates nothing. Starting boxes the definition once and allocates its playback state; nothing is copied per frame.
tweens.gd is made with math & ferrets, copyright © 2026 its contributors.
Godot logo by Andrea Calabró, licensed under CC BY 4.0.
"Easy, the Ferret" illustrations drawn by foxy_maria.
tweens.gd is released under the MIT License.
Godot is licensed under the MIT License.
tweens.gd is not affiliated with or endorsed by the Godot Foundation.