MeatMotion

ManualMotionDispatcher

Drive tweens manually, with storage organized by motion type. Pass its Scheduler to the builder and advance it in seconds with Update.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public sealed class ManualMotionDispatcher
ManualMotionDispatcher.cs · L9

Set the clock in a test

Add using MeatMotion;. Time is absolute, while Update takes a delta in seconds. The two writes produce 3 then 4.

float value = 0f;
var clock = new ManualMotionDispatcher();
MMotion.Create(0f, 10f, 1f).WithScheduler(clock.Scheduler)
    .Bind(v => value = v);
clock.Time = 0.3;
clock.Update(0.1);
clock.Reset();

Members

Default

Return the shared manual dispatcher.

public static readonly ManualMotionDispatcher Default;

Scheduler

Scheduler for binding motions to this dispatcher's manual clock.

public IMotionScheduler Scheduler { get; }

ManualMotionDispatcher

Create a dispatcher with its own clock and Scheduler.

public ManualMotionDispatcher()

Time

Read the manual clock in seconds. Writing advances it by the difference from the current time.

public double Time { get; set; }

Update

Advance the clock and bring each per-type world up to that time. A newly created world starts at zero and catches up on its first update. Recursive updates and non-finite times are rejected.

public void Update(double deltaTime)
Parameters
deltaTime
double Seconds to advance from the preceding update.

Reset

Reset the manual clock to zero and clear its storage without invoking callbacks.

EnsureStorageCapacity

Reserve the manual storage for this value, options and adapter combination.

public void EnsureStorageCapacity<TValue, TOptions, TAdapter>(int capacity)
    where TValue : unmanaged
    where TOptions : unmanaged, IMotionOptions
    where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>
Parameters
capacity
int Number of entries to reserve.