Skip to content
tweens.gd

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); // Constructor
var pulse = new Tweens.Scale2D(1.2, 0.2) { PingPong = true }; // Initializer
var slow = arrive with { Duration = 1.2 }; // Copy
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.

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, and Fill.
  • Easing: Ease, BlendType, Blend, Skew, Weks, EaseFunction, and Curve.
  • Color interpolation: ColorSpace, AlphaMode, and ColorEncoding; defaults are OKLab, premultiplied alpha, and sRGB input/output.
  • Callbacks: OnAdd through OnFinally, and SuppressCallbacksWhenTargetInvalid.
Member Type Meaning
Options TweenOptions Every timing and easing member, SuppressCallbacksWhenTargetInvalid, and the duration and delay factors, as one value

Whole-color interpolation defaults to ColorSpace.Oklab; Srgb and LinearRgb select other working spaces.

AlphaMode.Premultiplied is the default. Straight interpolates color coordinates and alpha independently.

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.

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);
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
  • Starting snapshots the configuration. Later with copies 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 Curve resources are duplicated for each playback.
  • A with copy 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.