Tween
Sequences of property changes, callbacks and timed steps.
Create a usable Tween through CreateTween() rather than new Tween(): the direct constructor emits a native error. Append commands before the first step. Commands are sequential by default; Parallel() groups the next append, SetParallel() changes the default, and Chain() starts the next step.
Pause() preserves progress; Stop() resets internal start/time but not properties; Kill() invalidates without Finished. Tree cleanup follows natural completion; create a new Tween for another animation.
BindEntity() manages lifecycle separately from a TweenProperty target. A property EntityPath such as position:x is not an Entity path. Ordinary callbacks run during Tween processing rather than on workers.
Manual CustomStep() after Pause is useful for deterministic checks. Current code still returns true on the step emitting Finished; the next call returns false. GetTotalElapsedTime() includes scaled delta and possible overshoot.
Windows headless checks confirm values, grouping and signals; visual quality, real frame rates, physics/tree-pause/time-scale transitions and precise subtween timing were not accepted here.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
TweenConstructor
public Tween();Direct new Tween() is not a usable animation: the native constructor emits an error and leaves an invalid object. Use Entity.CreateTween() or EntityTree.CreateTween() and append commands before the first step. SDK constructor availability is not a recommendation to call it.
Methods28
BindEntityTween
public Tween BindEntity(Entity node);Binds lifecycle and Bound pause behavior to an Entity rather than setting every TweenProperty target. While the Entity is outside the tree, the sequence does not advance even through CustomStep. After object destruction tree processing ends the sequence. Entity.CreateTween binds automatically; EntityTree.CreateTween is configured separately.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
nodeLive binding-owner Entity, not necessarily every property target.
TweenThe same Tween for chaining, not a new independent copy.
ChainTween
public Tween Chain();Makes only the next appended Tweener start a new sequential step. Useful after SetParallel(true) to await the whole parallel group. Does not execute commands immediately or change the defaultParallel setting for every later append.
TweenThe same Tween for chaining, not a new independent copy.
CustomStepbool
public bool CustomStep(double delta);Manually advances by delta with SpeedScale, including while paused. Does not permanently Play the sequence or bypass a bound Entity needing tree membership. Do not call recursively within the same step. In 1.0.0 the step emitting Finished still returns true; the following call on the completed sequence returns false. Thus the bool is not an exact completion event. Pause before manual tests to avoid concurrent automatic advancement.
| Name | Type | Default |
|---|---|---|
delta | double | — |
deltaPositive finite manual seconds, then multiplied by SpeedScale.
boolNative step result; still true on the Finished-emitting step, false on the next completed-Tween call.
GetLoopsLeftint
public int GetLoopsLeft();Remaining full passes including the current one. SetLoops(2) means two total passes rather than two additional repeats. Returns −1 for loops<=0 and 0 after finite completion. Not a time or step count.
intRemaining passes, −1 for infinite, 0 after finite completion.
GetTotalElapsedTimedouble
public double GetTotalElapsedTime();Accumulated input delta with SpeedScale, including loops and overshoot in the final manual step. Not exact animation duration or wall-clock seconds. Stop resets it; Pause preserves it.
doubleAccumulated scaled delta, potentially exceeding actual duration.
HasTweenersbool
public bool HasTweeners();Checks for stored commands. Does not imply validity, running state or remaining work: Kill does not immediately clear the list, while later tree cleanup does.
boolTrue for a nonempty command list.
InterpolateValueVariant
public static Variant InterpolateValue(Variant initialValue, Variant deltaValue, double elapsedTime, double duration, Tween.TransitionType transType, Tween.EaseType easeType);Statically computes Variant interpolation without creating a Tween or modifying an object. deltaValue is final minus initial, not the final value itself. duration=0 returns initialValue+deltaValue. Supply valid transition/ease enums and supported Variant types. This pass tested numeric scalars, not universal interpolation of arbitrary objects.
| Name | Type | Default |
|---|---|---|
initialValue | Variant | — |
deltaValue | Variant | — |
elapsedTime | double | — |
duration | double | — |
transType | Tween.TransitionType | — |
easeType | Tween.EaseType | — |
initialValueInitial value of a supported Variant type.
deltaValueFinal-minus-initial difference, not the final value.
elapsedTimePosition on the interpolation timeline, not a clock reading.
durationSeconds duration; validate finiteness/nonnegativity. Zero in InterpolateValue yields the final value.
transTypeValid TransitionType for static interpolation.
easeTypeValid EaseType for static interpolation.
VariantOwned result Variant; dispose the wrapper after reading.
IsRunningbool
public bool IsRunning();Returns the Play flag. False after Pause/Stop/Kill or finite completion. True alone proves neither validity nor progress this frame or an available bound object; also account for IsValid and pause behavior.
boolAdvancement-enabled flag, not guaranteed validity/processing.
IsValidbool
public bool IsValid();Reports usability in the current sequence lifecycle. new Tween is invalid; Kill immediately makes this false. After natural Finished, tree cleanup can happen on a subsequent pass. Valid promises neither IsRunning nor permission to append after starting without Stop.
boolUsability flag in the current lifecycle.
Killvoid
public void Kill();Stops and immediately invalidates the sequence, including its subtweens. Emits no Finished and restores no changed properties. Not equivalent to Pause: a killed sequence cannot resume through Play.
ParallelTween
public Tween Parallel();Makes only the next appended Tweener join the current step. Later additions again follow SetParallel. The step ends after its longest participant; this is animation-command parallelism, not OS threading.
TweenThe same Tween for chaining, not a new independent copy.
Pausevoid
public void Pause();Pauses automatic progression while preserving the step, time and properties. Play resumes; CustomStep can advance manually. Distinct from Stop, which resets internal start/time bookkeeping.
Playvoid
public void Play();Enables a valid Tween to advance after Pause/Stop. Revives no killed sequence and guarantees no processing while tree pause/bound membership blocks it. Create a new object after natural completion and cleanup.
SetEaseTween
public Tween SetEase(Tween.EaseType ease);Sets default easing for subsequently appended Property/MethodTweeners. Existing commands retain captured settings; use their own setters if needed. Changes neither duration nor processing mode.
| Name | Type | Default |
|---|---|---|
ease | Tween.EaseType | — |
easeEasing for subsequently appended commands.
TweenThe same Tween for chaining, not a new independent copy.
SetIgnoreTimeScaleTween
public Tween SetIgnoreTimeScale(bool ignore = true);Selects the tree unscaled delta for automatic processing. Does not bypass Pause, tree pause mode or bound lifecycle. CustomStep takes caller-supplied delta and separately applies SpeedScale. Actual automatic TimeScale behavior was source-reviewed rather than measured here.
| Name | Type | Default |
|---|---|---|
ignore | bool | true |
ignoreTrue selects unscaled delta during automatic processing.
TweenThe same Tween for chaining, not a new independent copy.
SetLoopsTween
public Tween SetLoops(int loops = 0);Sets total passes: 1 means one, 2 means two. Calling without an argument defaults to 0 and enables infinite repetition, as do negative values. Provide real elapsed time or a stop condition: infinitely repeated zero-duration commands can trigger infinite-loop diagnostics.
| Name | Type | Default |
|---|---|---|
loops | int | 0 |
loopsTotal passes; <=0 means infinite.
TweenThe same Tween for chaining, not a new independent copy.
SetParallelTween
public Tween SetParallel(bool parallel = true);Changes default grouping for later additions. True places them in one step; Chain starts a new step for the next addition. False restores sequential appending. Does not execute commands on separate threads.
| Name | Type | Default |
|---|---|---|
parallel | bool | true |
parallelDefault common-step appending mode, not thread startup.
TweenThe same Tween for chaining, not a new independent copy.
SetPauseModeTween
public Tween SetPauseMode(Tween.TweenPauseMode mode);Sets tree-pause behavior: Bound follows the bound Entity, Stop stops advancing during tree pause, and Process permits it. Does not itself call Tween Pause/Play. Bound without binding creates no owner. Actual tree-pause transitions were source-reviewed only.
| Name | Type | Default |
|---|---|---|
mode | Tween.TweenPauseMode | — |
modeBound/Stop/Process for tree-pause behavior.
TweenThe same Tween for chaining, not a new independent copy.
SetProcessModeTween
public Tween SetProcessMode(Tween.TweenProcessMode mode);Selects Idle or Physics for automatic tree advancement. Physics makes neither a physics simulation nor an exact timing/sample-count guarantee. Manual CustomStep does not wait for that callback. Automatic physics processing was not executed here.
| Name | Type | Default |
|---|---|---|
mode | Tween.TweenProcessMode | — |
modeIdle or Physics for automatic stepping.
TweenThe same Tween for chaining, not a new independent copy.
SetSpeedScaleTween
public Tween SetSpeedScale(float speed);Multiplier for delta and accumulated time, not a replacement duration for every command. Normally supply a positive finite value; 2 advances time twice as fast. Zero advances no steps; negative is not reverse-playback support. Value 2 was tested with manual steps.
| Name | Type | Default |
|---|---|---|
speed | float | — |
speedTime multiplier; use a positive finite value.
TweenThe same Tween for chaining, not a new independent copy.
SetTransTween
public Tween SetTrans(Tween.TransitionType trans);Sets default transition for future Property/MethodTweeners. Existing commands are not automatically reconfigured. Use Linear for linear interpolation; individual curves were not visually assessed here.
| Name | Type | Default |
|---|---|---|
trans | Tween.TransitionType | — |
transTransition for subsequently appended commands.
TweenThe same Tween for chaining, not a new independent copy.
Stopvoid
public void Stop();Stops and resets internal start/elapsed time while retaining commands. Restores no original properties and emits no Finished. At the next start a PropertyTweener may resample the already changed current value by default. While valid, Stop allows changing the list before restarting; after tree cleanup use a new Tween.
TweenAwaitAwaitTweener
public AwaitTweener TweenAwait(Signal signal);Appends a Signal wait, not a C# Task or retrospective wait for every earlier event. Connection is made when appended, but received resets when the step starts: early emission guarantees no later completion. Completion is observed on a subsequent step rather than synchronously completing the whole Tween. A destroyed source/missing connection also finishes this Tweener; completion does not prove a signal was received. Configure timeout on the returned AwaitTweener.
| Name | Type | Default |
|---|---|---|
signal | Signal | — |
signalSignal from a live source; an early event before step start may be reset.
AwaitTweenerAppended AwaitTweener for configuration; invalid use can yield null and diagnostics.
TweenCallbackCallbackTweener
public CallbackTweener TweenCallback(Callable callback);Appends a no-argument Callable invoked when its step is reached, not immediately on append. Retain required data/target; do not pass the result of an already invoked call. Callback is not automatically offloaded to a worker.
| Name | Type | Default |
|---|---|---|
callback | Callable | — |
callbackCallable requiring no supplied arguments, invoked later.
CallbackTweenerAppended CallbackTweener for configuration; invalid use can yield null and diagnostics.
TweenIntervalIntervalTweener
public IntervalTweener TweenInterval(double time);Appends a timed interval within the sequence, not a blocking main-thread sleep. Time is consumed by Tween steps and affected by speed/automatic time-scale policy. In a parallel group it is considered alongside the other participants.
| Name | Type | Default |
|---|---|---|
time | double | — |
timeNonnegative finite interval duration in seconds.
IntervalTweenerAppended IntervalTweener for configuration; invalid use can yield null and diagnostics.
TweenMethodMethodTweener
public MethodTweener TweenMethod(Callable method, Variant from, Variant to, double duration);Passes one interpolated value from from to to into the Callable on processing steps. Callback must accept the appropriate Variant type; not a property name. from/to are initial/final values, unlike InterpolateValue deltaValue. A double callback with Linear was tested; unknown types/call failures were not executed.
| Name | Type | Default |
|---|---|---|
method | Callable | — |
from | Variant | — |
to | Variant | — |
duration | double | — |
methodCallable accepting one interpolated value.
fromInitial value; match type with to and callback.
toFinal value, not the from/to difference.
durationSeconds duration; validate finiteness/nonnegativity. Zero in InterpolateValue yields the final value.
MethodTweenerAppended MethodTweener for configuration; invalid use can yield null and diagnostics.
TweenPropertyPropertyTweener
public PropertyTweener TweenProperty(ReckfellObject @object, EntityPath property, Variant finalVal, double duration);Appends an object property change to finalVal. EntityPath here is a property/component path such as position:x, not an Entity tree path. The property must exist and types must match. By default the initial value is sampled when the command starts, which matters after Stop/delay. Providing a target alone does not automatically bind lifecycle; use BindEntity/Entity.CreateTween.
| Name | Type | Default |
|---|---|---|
object | ReckfellObject | — |
property | EntityPath | — |
finalVal | Variant | — |
duration | double | — |
objectLive object exposing the property, not an object name/path.
propertyProperty/component EntityPath, for example position:x.
finalValFinal value compatible with the current property type.
durationSeconds duration; validate finiteness/nonnegativity. Zero in InterpolateValue yields the final value.
PropertyTweenerAppended PropertyTweener for configuration; invalid use can yield null and diagnostics.
TweenSubtweenSubtweenTweener
public SubtweenTweener TweenSubtween(Tween subtween);Embeds a prepared Tween in the parent sequence and removes it from independent tree processing. At start the command resets the subtween with Stop and plays it; parent Kill propagates to children. Do not share one subtween between multiple owners or create cycles. Kill propagation was tested; precise subtween advancement was source-reviewed only.
| Name | Type | Default |
|---|---|---|
subtween | Tween | — |
subtweenPrepared sequence without cyclic/shared ownership.
SubtweenTweenerAppended SubtweenTweener for configuration; invalid use can yield null and diagnostics.
Signals and events3
FinishedEvent
public event Action Finished;Signal after the final pass of a finite sequence. Kill and Stop do not emit it. Infinite loops have no natural Finished. Tree cleanup invalidates the sequence; create a new Tween for another animation rather than relying on reusing the old one.
LoopFinishedEvent
public event Tween.LoopFinishedEventHandler LoopFinished;Emitted after a pass when another pass follows. A finite Tween final pass emits Finished instead. loopCount is the number of completed passes and starts at 1.
| Name | Type | Default |
|---|---|---|
loopCount | long | — |
loopCountCompleted-pass count starting at 1; the final pass emits Finished.
StepFinishedEvent
public event Tween.StepFinishedEventHandler StepFinished;Signal for completion of a zero-based step. A step may contain several parallel Tweeners and finishes after all of them. Does not mean the whole Tween completed; step indices repeat across loops.
| Name | Type | Default |
|---|---|---|
idx | long | — |
idxCompleted-step index from 0, not a frame/loop index.
Tween.EaseType
| Value | Description |
|---|---|
In = 0 | The interpolation starts slowly and speeds up towards the end. |
InOut = 2 | A combination of |
Out = 1 | The interpolation starts quickly and slows down towards the end. |
OutIn = 3 | A combination of |
Tween.TransitionType
| Value | Description |
|---|---|
Back = 10 | The animation is interpolated backing out at ends. |
Bounce = 9 | The animation is interpolated by bouncing at the end. |
Circ = 8 | The animation is interpolated with a function using square roots. |
Cubic = 7 | The animation is interpolated with a cubic (to the power of 3) function. |
Elastic = 6 | The animation is interpolated with elasticity, wiggling around the edges. |
Expo = 5 | The animation is interpolated with an exponential (to the power of x) function. |
Linear = 0 | The animation is interpolated linearly. |
Quad = 4 | The animation is interpolated with a quadratic (to the power of 2) function. |
Quart = 3 | The animation is interpolated with a quartic (to the power of 4) function. |
Quint = 2 | The animation is interpolated with a quintic (to the power of 5) function. |
Sine = 1 | The animation is interpolated using a sine function. |
Spring = 11 | The animation is interpolated like a spring towards the end. |
Tween.TweenPauseMode
| Value | Description |
|---|---|
Bound = 0 | If the |
Process = 2 | The |
Stop = 1 | If |
Tween.TweenProcessMode
| Value | Description |
|---|---|
Idle = 1 | The |
Physics = 0 | The |