MeatMotion

MotionHandle

Control a scheduled tween's time, playback speed and lifetime. Seek a sequence through its parent handle once it owns the child.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public struct MotionHandle : IEquatable<MotionHandle>
MotionHandle.cs · L5

Seek and stop at the current value

Use using MeatMotion;. Seeking to 0.75 s writes 6. After cancellation, advancing the world leaves the value at 6.

float value = 0f;
using var world = new MotionWorld();
var handle = MMotion.Create(0f, 8f, 1f)
    .WithScheduler(world)
    .Bind(v => value = v);
handle.Time = 0.75;
handle.Cancel();
world.Tick(0.1);

Members

StorageId

Identifies the storage containing the referenced slot.

public int StorageId;

Index

Slot index inside a storage. Handle identity also includes StorageId and Version.

public int Index;

Version

Generation number used to distinguish reuse of the same slot.

public int Version;

None

Default handle that refers to no tween.

public static readonly MotionHandle None;

ToString

Return the string representation.

public override readonly string ToString()
Return value
Returns
string

Equals

Compare for value equality.

public readonly bool Equals(MotionHandle other)
Parameters and return value
other
MotionHandle Operand for the equality comparison.
Returns
bool
public override readonly bool Equals(object obj)
Parameters and return value
obj
object Operand for the equality comparison.
Returns
bool

GetHashCode

Return the hash code used with value equality.

public override readonly int GetHashCode()
Return value
Returns
int

operator ==

Test whether the handles identify the same motion.

public static bool operator ==(MotionHandle a, MotionHandle b)
Parameters and return value
a
MotionHandle Operand for the equality comparison.
b
MotionHandle Operand for the equality comparison.
Returns
bool

operator !=

Test whether the handles identify different motions.

public static bool operator !=(MotionHandle a, MotionHandle b)
Parameters and return value
a
MotionHandle Operand for the equality comparison.
b
MotionHandle Operand for the equality comparison.
Returns
bool

IsActive

Check whether the motion is active. A preserved motion can remain active at its endpoint.

public readonly bool IsActive()
Return value
Returns
bool

IsPlaying

Return true for an active motion that has not ended. A playback speed of zero alone does not make this false.

public readonly bool IsPlaying()
Return value
Returns
bool

TotalDuration

Total timeline length in seconds including delays and loops. Infinite looping yields positive infinity.

public readonly double TotalDuration { get; }

Duration

Read the configured interpolation duration in seconds.

public readonly float Duration { get; }

Delay

Read the delay in seconds configured on the builder.

public readonly float Delay { get; }

Loops

Read the configured loop count.

public readonly int Loops { get; }

CompletedLoops

Read the number of completed loops from a root handle.

public readonly int CompletedLoops { get; }

PlaybackSpeed

One is normal speed, zero holds time, and negative values reverse direction. NaN and infinity are rejected.

public float PlaybackSpeed { get; set; }

Preserve

Retain a root motion so the handle can seek it again after it completes.

public MotionHandle Preserve()
Return value
Returns
MotionHandle

Time

Read elapsed seconds, or write a finite time to seek a root motion and apply its value there.

public double Time { get; set; }

Complete

Seek a finite root motion to its end and complete it. Infinite motions and sequence-owned children cannot be completed directly.

public void Complete()

Cancel

Stop a root motion at its current value and notify cancellation.

public void Cancel()

TryComplete

Complete a playing, finite root and report whether the request succeeded.

public bool TryComplete()
Return value
Returns
bool

TryCancel

Cancel an active root and return true. Invalid handles and sequence-owned children return false.

public bool TryCancel()
Return value
Returns
bool

Related types