MeatMotion

CompositeMotionHandle

Collect motion handles and request cancellation or completion for the group.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public sealed class CompositeMotionHandle : ICollection<MotionHandle>
MotionHandleExtensions.cs · L25

Cancel two tweens together

Add using MeatMotion;. Collect the motions owned by one screen and stop them together when it closes.

var group = new CompositeMotionHandle();
using var world = new MotionWorld();
var first = MMotion.Create(0f, 1f, 1f).WithScheduler(world)
    .RunWithoutBinding().AddTo(group);
var second = MMotion.Create(1f, 0f, 1f).WithScheduler(world)
    .RunWithoutBinding().AddTo(group);
group.Cancel();

Members

CompositeMotionHandle

Create an empty collection, optionally reserving its initial capacity.

public CompositeMotionHandle()
public CompositeMotionHandle(int capacity)
Parameters
capacity
int Number of entries to reserve.

Count

Number of stored handles, regardless of whether their motions are still active.

public int Count { get; }

IsReadOnly

Returns false. The collection accepts additions and removals.

public bool IsReadOnly { get; }

Add

Append the handle to this collection.

public void Add(MotionHandle handle)
Parameters
handle
MotionHandle Handle to control or link.

Clear

Remove all registrations. Use Cancel to stop the motions.

Contains

Return whether the collection contains the handle.

public bool Contains(MotionHandle item)
Parameters and return value
item
MotionHandle Entry operated on by the collection.
Returns
bool

CopyTo

Copy the stored handles into an array at the specified destination index.

public void CopyTo(MotionHandle[] array, int arrayIndex)
Parameters
array
MotionHandle[] Destination array for the handles.
arrayIndex
int First destination index in the array.

Remove

Remove a matching handle from the collection and leave its motion running.

public bool Remove(MotionHandle item)
Parameters and return value
item
MotionHandle Entry operated on by the collection.
Returns
bool

GetEnumerator

Enumerate the stored handles in list order.

public List<MotionHandle>.Enumerator GetEnumerator()
Return value
Returns
List<MotionHandle>.Enumerator

Complete

Complete active entries. If one completion throws, retain the failed and unprocessed entries.

Cancel

Cancel active handles in the batch and remove processed registrations.