MotionSequenceBuilder
Place child tweens on one timeline with Append, Join and Insert. After Run, use the parent handle to seek or stop the sequence.
public struct MotionSequenceBuilder : IDisposableMotionSequenceBuilder.cs · L7Animate one property in two stages
Add using MeatMotion;. Move to 4 in one second, wait for half a second, then move back over one second. At t = 2 the value is 2.
float value = 0f;
using var world = new MotionWorld();
var first = MMotion.Create(0f, 4f, 1f).WithScheduler(world)
.Bind(v => value = v);
var back = MMotion.Create(4f, 0f, 1f).WithScheduler(world)
.WithImmediateBind(false).Bind(v => value = v);
var parent = LSequence.Create()
.Append(first).AppendInterval(0.5f).Append(back)
.Run(clock => clock.WithScheduler(world));
parent.Time = 2.0;
Members
Append
Place a finite child at the append cursor and advance the cursor by its duration.
public readonly MotionSequenceBuilder Append(MotionHandle handle)Parameters and return value
handleMotionHandleHandle to control or link.- Returns
MotionSequenceBuilder
AppendInterval
Advance the append cursor by the interval in seconds. Overlapping children can keep playing during the interval.
public readonly MotionSequenceBuilder AppendInterval(float interval)Parameters and return value
intervalfloatSeconds by which to move the append cursor.- Returns
MotionSequenceBuilder
Join
Place a child at the start of the most recently appended interval without advancing the append cursor.
public readonly MotionSequenceBuilder Join(MotionHandle handle)Parameters and return value
handleMotionHandleHandle to control or link.- Returns
MotionSequenceBuilder
Insert
Place a child at an absolute time in seconds without advancing the append cursor.
public readonly MotionSequenceBuilder Insert(float position, MotionHandle handle)Parameters and return value
positionfloatPlacement time in seconds from the start of the sequence.handleMotionHandleHandle to control or link.- Returns
MotionSequenceBuilder
public readonly MotionSequenceBuilder Insert(double position, MotionHandle handle)Parameters and return value
positiondoublePlacement time in seconds from the start of the sequence.handleMotionHandleHandle to control or link.- Returns
MotionSequenceBuilder
Run
Schedule the children and return the parent handle. Use configuration to customize the parent clock, callbacks or scheduler.
public MotionHandle Run(Action<MotionBuilder<double, NoOptions, DoubleMotionAdapter>> configuration)Parameters and return value
configurationAction<MotionBuilder<double, NoOptions, DoubleMotionAdapter>>Callback that configures the parent timeline builder.- Returns
MotionHandle
Dispose
Dispose an unplayed builder. MSequence cancels pending children while LSequence retains ownership of them.
public void Dispose()
MeatMotion