Skip to content
Eduard Gushchin edited this page Jul 1, 2026 · 5 revisions

Home | API by Category | Complete API Index | API Compatibility

Field Value
Full name Electron2D.Tween
Namespace Electron2D
Kind class
Category Animation and Tweening

Overview

Runs sequential property, interval and callback animation steps.

Syntax

public class Electron2D.Tween : Electron2D.RefCounted

Godot 4.7 C# profile compatibility

Profile: Electron2D 0.1.0 2D
Status: Partial / Not verified
Out of profile: yes
Godot reference: Tween

Sequential runtime tween with property, interval and callback steps, easing, pause/play/stop, kill, manual stepping and completion signals.

Remarks

Create runtime tweens with Electron2D.SceneTree.CreateTween or Electron2D.Node.CreateTween. A manually constructed tween is useful only as an invalid value for API parity checks and cannot receive tweeners.

Electron2D 0.1.0 Preview processes tweens after node process callbacks and before draw callbacks. This baseline supports sequential tweeners, easing, pause/resume, stop, cancellation and completion signals.

Thread Safety

This type is not synchronized. Create and mutate tweens on the main scene thread that owns the scene tree.

Since

This type is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node.CreateTween
  • Electron2D.SceneTree.CreateTween
  • Electron2D.Tweener

Members

Member Kind Summary
Electron2D.Tween() Constructor Creates an invalid standalone tween.
BindNode(Electron2D.Node) Method Binds this tween to a node lifetime.
CustomStep(System.Double) Method Manually advances this tween by a delta time.
GetTotalElapsedTime() Method Gets the accumulated processed time for this tween.
HasTweeners() Method Checks whether this tween has any tweeners.
InterpolateValue(Electron2D.Variant, Electron2D.Variant, System.Double, System.Double, Electron2D.Tween.TransitionType, Electron2D.Tween.EaseType) Method Computes an eased interpolated value from an initial value and delta.
IsRunning() Method Checks whether this tween is currently advancing automatically.
IsValid() Method Checks whether this tween is registered and can accept tweeners.
Kill() Method Cancels this tween and removes it from scene tree processing.
Pause() Method Pauses automatic processing for this tween.
Play() Method Starts or resumes automatic processing for this tween.
SetEase(Electron2D.Tween.EaseType) Method Sets the default ease mode for subsequently added property tweeners.
SetSpeedScale(System.Double) Method Sets the speed multiplier used by future tween processing steps.
SetTrans(Electron2D.Tween.TransitionType) Method Sets the default transition for subsequently added property tweeners.
Stop() Method Stops this tween and rewinds its sequence time.
TweenCallback(Electron2D.Callable) Method Adds a callback tweener to this tween.
TweenInterval(System.Double) Method Adds a time-only interval to this tween.
TweenProperty(Electron2D.Object, Electron2D.NodePath, Electron2D.Variant, System.Double) Method Adds a property tweener to this tween.

Member Details

Electron2D.Tween()

Kind: Constructor

public Electron2D.Tween()

Summary

Creates an invalid standalone tween.

Remarks

Standalone tweens are not registered in a scene tree and cannot receive tweeners. Use Electron2D.SceneTree.CreateTween or Electron2D.Node.CreateTween for runtime animation.

The constructor registers the finished and step_finished signals so callers can inspect signal availability even before the tween is registered.

Thread Safety

Construction is safe on any thread when the instance is not shared until construction completes.

Since

This constructor is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.IsValid

BindNode(Electron2D.Node)

Kind: Method

public Electron2D.Tween BindNode(Electron2D.Node)(Electron2D.Node node)

Summary

Binds this tween to a node lifetime.

Remarks

A bound tween advances automatically only while the node is valid and inside a scene tree. The tween remains valid while the node is detached, but Electron2D.Tween.IsRunning returns false until the node is valid again.

Parameters

  • node: The node that controls automatic tween processing.

Returns

This tween instance.

Exceptions

  • System.ArgumentNullException: Thrown when node is null.
  • System.InvalidOperationException: Thrown when this tween is not registered in a scene tree.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Node.CreateTween

CustomStep(System.Double)

Kind: Method

public System.Boolean CustomStep(System.Double)(System.Double delta)

Summary

Manually advances this tween by a delta time.

Remarks

Manual stepping works while the tween is paused. It still respects bound node validity and does not advance a tween whose bound node is outside the scene tree.

Parameters

  • delta: The finite non-negative delta time in seconds.

Returns

true when the tween is still valid after the step; otherwise, false.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when delta is negative or not finite.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

GetTotalElapsedTime()

Kind: Method

public System.Double GetTotalElapsedTime()()

Summary

Gets the accumulated processed time for this tween.

Remarks

The value is reset by Electron2D.Tween.Stop and stops increasing while the tween is paused unless Electron2D.Tween.CustomStep(System.Double) is called.

Returns

The total elapsed time in seconds after speed scaling has been applied.

Thread Safety

This method is safe to call on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

HasTweeners()

Kind: Method

public System.Boolean HasTweeners()()

Summary

Checks whether this tween has any tweeners.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

true when this tween is valid and contains at least one tweener; otherwise, false.

Thread Safety

This method is safe to call on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

InterpolateValue(Electron2D.Variant, Electron2D.Variant, System.Double, System.Double, Electron2D.Tween.TransitionType, Electron2D.Tween.EaseType)

Kind: Method

public static Electron2D.Variant InterpolateValue(Electron2D.Variant, Electron2D.Variant, System.Double, System.Double, Electron2D.Tween.TransitionType, Electron2D.Tween.EaseType)(Electron2D.Variant initialValue, Electron2D.Variant deltaValue, System.Double elapsedTime, System.Double duration, Electron2D.Tween.TransitionType transType, Electron2D.Tween.EaseType easeType)

Summary

Computes an eased interpolated value from an initial value and delta.

Remarks

The normalized interpolation weight is clamped to the range 0 through 1. A zero duration produces the final supported value immediately.

The supported type set is intentionally small for 0.1.0 Preview: integer, floating-point, Electron2D.Vector2 and Electron2D.Color.

Parameters

  • initialValue: The value at elapsed time zero.
  • deltaValue: The difference between the final and initial values.
  • elapsedTime: The finite non-negative elapsed time in seconds.
  • duration: The finite non-negative duration in seconds.
  • transType: The transition curve to apply.
  • easeType: The ease mode to apply.

Returns

The interpolated value for supported numeric, Electron2D.Vector2 and Electron2D.Color variants; otherwise, initialValue.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when a numeric argument is negative or not finite, or when an enum value is outside the supported range.

Thread Safety

This method is safe to call from any thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.TweenProperty(Electron2D.Object,Electron2D.NodePath,Electron2D.Variant,System.Double)

IsRunning()

Kind: Method

public System.Boolean IsRunning()()

Summary

Checks whether this tween is currently advancing automatically.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

true when this tween is valid, playing, has pending tweeners and its bound node can be processed; otherwise, false.

Thread Safety

This method is safe to call on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

IsValid()

Kind: Method

public System.Boolean IsValid()()

Summary

Checks whether this tween is registered and can accept tweeners.

Remarks

This method follows the validation and lifetime rules of its declaring type.

Returns

true when the tween is valid; otherwise, false.

Thread Safety

This method is safe to call on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

Kill()

Kind: Method

public System.Void Kill()()

Summary

Cancels this tween and removes it from scene tree processing.

Remarks

Killing a tween clears pending tweeners and does not emit the finished signal.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.Stop

Pause()

Kind: Method

public System.Void Pause()()

Summary

Pauses automatic processing for this tween.

Remarks

Pausing preserves the current step and elapsed time. Use Electron2D.Tween.Play to resume automatic processing or Electron2D.Tween.CustomStep(System.Double) to advance manually while paused.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.Play

Play()

Kind: Method

public System.Void Play()()

Summary

Starts or resumes automatic processing for this tween.

Remarks

Calling this method after Electron2D.Tween.Pause resumes from the current step. Calling it after Electron2D.Tween.Stop starts again from elapsed time zero.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.Pause
  • Electron2D.Tween.Stop

SetEase(Electron2D.Tween.EaseType)

Kind: Method

public Electron2D.Tween SetEase(Electron2D.Tween.EaseType)(Electron2D.Tween.EaseType ease)

Summary

Sets the default ease mode for subsequently added property tweeners.

Remarks

Existing property tweeners keep the ease mode they had when they were created or later changed through Electron2D.PropertyTweener.SetEase(Electron2D.Tween.EaseType).

Parameters

  • ease: The ease mode to use.

Returns

This tween instance.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when ease is outside the supported enum range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.SetTrans(Electron2D.Tween.TransitionType)

SetSpeedScale(System.Double)

Kind: Method

public Electron2D.Tween SetSpeedScale(System.Double)(System.Double speed)

Summary

Sets the speed multiplier used by future tween processing steps.

Remarks

A value of 1 advances at normal speed. A value of 0 keeps the tween valid but prevents positive frame deltas from advancing time.

Parameters

  • speed: The finite non-negative speed multiplier.

Returns

This tween instance.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when speed is negative or not finite.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween

SetTrans(Electron2D.Tween.TransitionType)

Kind: Method

public Electron2D.Tween SetTrans(Electron2D.Tween.TransitionType)(Electron2D.Tween.TransitionType trans)

Summary

Sets the default transition for subsequently added property tweeners.

Remarks

Existing property tweeners keep the transition they had when they were created or later changed through Electron2D.PropertyTweener.SetTrans(Electron2D.Tween.TransitionType).

Parameters

  • trans: The transition curve to use.

Returns

This tween instance.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when trans is outside the supported enum range.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.SetEase(Electron2D.Tween.EaseType)

Stop()

Kind: Method

public System.Void Stop()()

Summary

Stops this tween and rewinds its sequence time.

Remarks

Stop keeps the tween valid and does not roll target properties back. Previously captured initial values are kept so a later Electron2D.Tween.Play starts the same sequence again from time zero.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.Tween.Kill
  • Electron2D.Tween.Play

TweenCallback(Electron2D.Callable)

Kind: Method

public Electron2D.CallbackTweener TweenCallback(Electron2D.Callable)(Electron2D.Callable callback)

Summary

Adds a callback tweener to this tween.

Remarks

The callback is called once when its turn in the sequence is reached. Calling Electron2D.Tween.Kill before the step is reached prevents the callback from running.

Parameters

  • callback: The callable to invoke when the sequence reaches this step.

Returns

The created Electron2D.CallbackTweener.

Exceptions

  • System.ArgumentException: Thrown when callback is null-like.
  • System.InvalidOperationException: Thrown when this tween is not valid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.CallbackTweener
  • Electron2D.Tween.TweenInterval(System.Double)

TweenInterval(System.Double)

Kind: Method

public Electron2D.IntervalTweener TweenInterval(System.Double)(System.Double time)

Summary

Adds a time-only interval to this tween.

Remarks

An interval consumes time without modifying target objects. It is useful for delaying later property or callback steps.

Parameters

  • time: The non-negative interval duration in seconds.

Returns

The created Electron2D.IntervalTweener.

Exceptions

  • System.ArgumentOutOfRangeException: Thrown when time is negative or not finite.
  • System.InvalidOperationException: Thrown when this tween is not valid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.IntervalTweener
  • Electron2D.Tween.TweenCallback(Electron2D.Callable)

TweenProperty(Electron2D.Object, Electron2D.NodePath, Electron2D.Variant, System.Double)

Kind: Method

public Electron2D.PropertyTweener TweenProperty(Electron2D.Object, Electron2D.NodePath, Electron2D.Variant, System.Double)(Electron2D.Object object, Electron2D.NodePath property, Electron2D.Variant finalVal, System.Double duration)

Summary

Adds a property tweener to this tween.

Remarks

The property path may address a public property or field by name, and may address nested public members with colon-separated subnames such as Position:X.

The initial value is captured the first time this tweener starts. Later calls to Electron2D.Tween.Stop reset elapsed time but keep that captured initial value.

Parameters

  • object: The object that owns the property.
  • property: The property path to write.
  • finalVal: The final value to assign when the tweener completes.
  • duration: The non-negative duration in seconds.

Returns

The created Electron2D.PropertyTweener.

Exceptions

  • System.ArgumentNullException: Thrown when object is null.
  • System.ArgumentOutOfRangeException: Thrown when duration is negative or not finite.
  • System.InvalidOperationException: Thrown when this tween is not valid.

Thread Safety

This method is not synchronized. Call it on the main scene thread.

Since

This method is available since Electron2D 0.1.0 Preview.

See Also

  • Electron2D.PropertyTweener
  • Electron2D.Tween.TweenCallback(Electron2D.Callable)
  • Electron2D.Tween.TweenInterval(System.Double)

Clone this wiki locally