Struct SequenceItem
Represents a single entry on the TweenSequence timeline. An item is one of three kinds - a child tween, an instant callback, or a silent interval - as indicated by ItemType.
Inherited Members
Namespace: Scylla.Core.Util.Tween
Assembly: ScyllaCore.dll
Syntax
public struct SequenceItem
Remarks
SequenceItem is a value type (struct) and is stored in the sequence's
internal item list by value. All mutation is performed by replacing the entry in
the list with a newly constructed instance via one of the static factory methods.
Factory methods:
- CreateTween(ITween, float, bool) - wraps an ITween at a given start time.
- CreateCallback(Action, float) - wraps an Action delegate at a given start time.
- CreateInterval(float, float) - represents an empty time gap of a given duration.
Properties
Callback
Gets the delegate associated with this item.
Declaration
public readonly Action Callback { get; }
Property Value
| Type | Description |
|---|---|
| Action | A non- |
Duration
Gets the duration of this item in seconds.
Declaration
public readonly float Duration { get; }
Property Value
| Type | Description |
|---|---|
| float | For a Tween item, this is the child tween's duration.
For an Interval item, this is the interval length.
For a Callback item, this is always |
IsJoined
Gets whether this item was added via Join(ITween), meaning it starts at the same time as the most recently appended non-joined item and plays in parallel with it.
Declaration
public readonly bool IsJoined { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
ItemType
Gets the kind of content this item represents - a tween, a callback, or an interval.
Declaration
public readonly SequenceItemType ItemType { get; }
Property Value
| Type | Description |
|---|---|
| SequenceItemType | One of the SequenceItemType values. |
StartTime
Gets the time in seconds, measured from the beginning of the owning TweenSequence, at which this item begins.
Declaration
public readonly float StartTime { get; }
Property Value
| Type | Description |
|---|---|
| float | A non-negative value in seconds. |
Tween
Gets the child tween associated with this item.
Declaration
public readonly ITween Tween { get; }
Property Value
| Type | Description |
|---|---|
| ITween |
Methods
CreateCallback(Action, float)
Creates a Callback item that invokes
callback when the owning TweenSequence's playhead
first reaches startTime.
Declaration
public static SequenceItem CreateCallback(Action callback, float startTime)
Parameters
| Type | Name | Description |
|---|---|---|
| Action | callback | The delegate to invoke at the specified timeline position. |
| float | startTime | The absolute time in seconds within the sequence at which the callback fires. |
Returns
| Type | Description |
|---|---|
| SequenceItem | A fully initialised SequenceItem value with Duration of |
CreateInterval(float, float)
Creates a Interval item that occupies a silent time
gap of duration seconds starting at startTime.
Declaration
public static SequenceItem CreateInterval(float duration, float startTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | duration | The length of the empty time gap in seconds. Used solely to advance the sequence's total duration and the append cursor; no animation or callback occurs. |
| float | startTime | The absolute start time in seconds within the owning TweenSequence. |
Returns
| Type | Description |
|---|---|
| SequenceItem | A fully initialised SequenceItem value with Tween and Callback both |
CreateTween(ITween, float, bool)
Creates a Tween item that wraps the given
tween and schedules it to start at startTime
seconds from the beginning of the sequence.
Declaration
public static SequenceItem CreateTween(ITween tween, float startTime, bool isJoined = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ITween | tween | The child tween to animate. May be |
| float | startTime | The absolute start time in seconds within the owning TweenSequence. |
| bool | isJoined |
|
Returns
| Type | Description |
|---|---|
| SequenceItem | A fully initialised SequenceItem value. |
GetEndTime()
Calculates the absolute end time of this item within the owning TweenSequence by summing StartTime and Duration.
Declaration
public float GetEndTime()
Returns
| Type | Description |
|---|---|
| float | The time in seconds at which this item finishes. For callback items this equals StartTime because their duration is zero. |