CompositeMotionHandle
Collect motion handles and request cancellation or completion for the group.
public sealed class CompositeMotionHandle : ICollection<MotionHandle>MotionHandleExtensions.cs · L25Cancel 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
capacityintNumber 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
handleMotionHandleHandle to control or link.
Clear
Remove all registrations. Use Cancel to stop the motions.
public void Clear()Contains
Return whether the collection contains the handle.
public bool Contains(MotionHandle item)Parameters and return value
itemMotionHandleEntry 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
arrayMotionHandle[]Destination array for the handles.arrayIndexintFirst 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
itemMotionHandleEntry 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.
public void Complete()Cancel
Cancel active handles in the batch and remove processed registrations.
public void Cancel()
MeatMotion