MotionWorld
Own a set of tweens and its update clock. Schedule builders into the world and advance it on the main thread with Tick.
public sealed class MotionWorld : IDisposable, IMotionSchedulerMotionWorld.cs · L12Drive two clocks independently
Add using MeatMotion;. Ticking one world leaves the other world's value at its starting point.
float a = 0f, b = 0f;
using var first = new MotionWorld();
using var second = new MotionWorld();
MMotion.Create(0f, 1f, 1f).WithScheduler(first).Bind(v => a = v);
MMotion.Create(0f, 1f, 1f).WithScheduler(second).Bind(v => b = v);
first.Tick(0.5);
Members
Default
Get the default automatically driven world.
public static MotionWorld Default { get; }MotionWorld
Create an independently driven world. Dispose it after use.
public MotionWorld(int capacity = 0)Parameters
capacity = 0intNumber of entries to reserve.
Schedule
Schedule the builder on this world's clock and return its handle.
public MotionHandle Schedule<TValue, TOptions, TAdapter>(ref MotionBuilder<TValue, TOptions, TAdapter> builder)
where TValue : unmanaged
where TOptions : unmanaged, IMotionOptions
where TAdapter : unmanaged, IMotionAdapter<TValue, TOptions>Parameters and return value
builderref MotionBuilder<TValue, TOptions, TAdapter>Configured builder, passed as the receiver for extension calls.- Returns
MotionHandle
EnsureCapacity
Reserve storage for the requested number of motions.
public void EnsureCapacity(int capacity)Parameters
capacityintNumber of entries to reserve.
Tick
Advance the world's scheduled motions by the supplied delta in seconds.
public void Tick(double deltaTime)Parameters
deltaTimedoubleSeconds to advance from the preceding update.
Dispose
Release this world's storage and its motions.
public void Dispose()CancelAll
Cancel the motions in this world.
public void CancelAll()
MeatMotion