Documentation
¶
Overview ¶
Package tween provides the Tween struct that allows an easing function to be animated over time. This can be used in tandem with the ease package to provide the easing functions.
Index ¶
- type Sequence
- func (seq *Sequence) Add(tweens ...*Tween)
- func (seq *Sequence) HasTweens() bool
- func (seq *Sequence) Index() int
- func (seq *Sequence) IsActiveTweenFinished() bool
- func (seq *Sequence) IsFinished() bool
- func (seq *Sequence) IsReversed() bool
- func (seq *Sequence) Remove(index int)
- func (seq *Sequence) Reset()
- func (seq *Sequence) SetIndex(index int)
- func (seq *Sequence) SetLoop(amount int)
- func (seq *Sequence) SetReverse(r bool)
- func (s *Sequence) Update(dt float32)
- func (seq *Sequence) Value() float32
- type Tween
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sequence ¶
type Sequence struct {
Tweens []*Tween
// YoyoEnabled makes the sequence "Yoyo" back to the beginning after it reaches the end
YoyoEnabled bool
// contains filtered or unexported fields
}
Sequence represents a sequence of Tweens, executed one after the other.
func NewSequence ¶
NewSequence returns a new Sequence object.
func (*Sequence) HasTweens ¶
HasTweens returns whether the Sequence is populated with Tweens or not.
func (*Sequence) Index ¶
Index returns the current index of the Sequence. Note that this can exceed the number of Tweens in the Sequence.
func (*Sequence) IsActiveTweenFinished ¶
IsActiveTweenFinished returns whether the currently active Tween is finished.
func (*Sequence) IsFinished ¶
IsFinished returns whether the entire Sequence is finished. This is true when all Tweens in the Sequence are finished and the Sequence has no remaining loops. If the Sequence is set to loop infinitely, this will always return false.
func (*Sequence) IsReversed ¶
IsReversed returns whether the Sequence currently running in reverse.
func (*Sequence) Reset ¶
func (seq *Sequence) Reset()
Reset resets the Sequence, resetting all Tweens and setting the Sequence's index back to 0.
func (*Sequence) SetIndex ¶
SetIndex sets the current index of the Sequence, influencing which Tween is active at any given time.
func (*Sequence) SetReverse ¶
SetReverse sets whether the Sequence will start running in reverse.
type Tween ¶
type Tween struct {
Reverse bool
// contains filtered or unexported fields
}
Tween encapsulates the easing function along with timing data. This allows a ease.TweenFunc to be used to be easily animated.
func NewTween ¶
NewTween will return a new Tween when passed a beginning and end value, the duration of the tween and the easing function to animate between the two values. The easing function can be one of the provided easing functions from the ease package or you can provide one of your own.
func (*Tween) IsFinished ¶
IsFinished will return true if the tween is finished.
func (*Tween) Reset ¶
func (t *Tween) Reset()
Reset will set the Tween to the beginning of the two values.