struct Sequence
Reference to a sequence.
Syntax
public readonly struct Sequence
Remarks
You must create a sequence using Peachy.Sequence.
Examples
// Create a new sequence.
var sequence = Peachy.Sequence()
.Append(
transform
.TweenPosition(new Vector3(5, 0, 1), 2f)
.Ease(Ease.SineOut)
).AppendCallback(
() => Debug.Log("Done moving!")
).Append(
transform.TweenRotation(new Vector3(90, 0, 0), 0.5f)
).Insert(
transform.ShakeRotation(
magnitude: 3f,
duration: 1.5f,
oscillationCount: 10,
decay: 1f,
randomness: 0.5f
),
time: 1f
);
// Get its tween to manipulate it.
var tween = sequence.ToTween();
tween.LoopForever();
Methods
View SourceAppend(Tween)
Add a tween to the sequence that starts when the last appended tween ends.
Declaration
public readonly Sequence Append(Tween tween)
Parameters
Type | Name | Description |
---|---|---|
Tween | tween | The tween to append. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
AppendCallback(Action)
Add a callback that will be invoked after the appended tween completes.
Declaration
public readonly Sequence AppendCallback(Action callback)
Parameters
Type | Name | Description |
---|---|---|
System.Action | callback | The callback. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
AppendInterval(Single)
Add a time delay to the sequence after the last appended tween.
Declaration
public readonly Sequence AppendInterval(float delay)
Parameters
Type | Name | Description |
---|---|---|
System.Single | delay | The duration of the interval in seconds. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
Insert(Single, Tween)
Add a tween to the sequence that starts at the specified time.
Declaration
public readonly Sequence Insert(float time, Tween tween)
Parameters
Type | Name | Description |
---|---|---|
System.Single | time | The start time of the tween in seconds. |
Tween | tween | The tween to insert. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
InsertCallback(Single, Action)
Add a callback to the sequence that will be invoked at the specified time.
Declaration
public readonly Sequence InsertCallback(float time, Action callback)
Parameters
Type | Name | Description |
---|---|---|
System.Single | time | The time to invoke the callback in seconds. |
System.Action | callback | The callback. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
Join(Tween)
Add a tween to the sequence that starts at the same time as the last appended tween.
Declaration
public readonly Sequence Join(Tween tween)
Parameters
Type | Name | Description |
---|---|---|
Tween | tween | The tween to join. |
Returns
Type | Description |
---|---|
Sequence | This sequence. |
ToTween()
Get the underlying tween that can be used to control this sequence.
Declaration
public readonly Tween ToTween()
Returns
Type | Description |
---|---|
Tween | The sequence's tween |
Operators
View SourceExplicit(Sequence to Tween)
Cast this sequence into its underlying tween.
Declaration
public static explicit operator Tween(Sequence sequence)
Parameters
Type | Name | Description |
---|---|---|
Sequence | sequence | The sequnce to cast. |
Returns
Type | Description |
---|---|
Tween | The sequence's tween |