forked from gucio321/giu-animations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanimation.go
29 lines (26 loc) · 1.23 KB
/
animation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package animations
type StarterFunc func(playMode PlayMode)
// Animation is an interface implemented by each animation.
type Animation interface {
// Init is called once, immediately on start.
Init()
// Reset is called whenever needs to restart animation.
Reset()
// BuildNormal is called every frame when animation is not running
// starter is a link to Animator.Start
BuildNormal(starterFunc StarterFunc)
// BuildAnimation is called when running an animation.
// It receives two values:
// - first one is animationPercentage after applying specified by Animator
// easing algorithm.
// ATTENTION: this value may be less than 0 or larger than 1
// - second value is arbitrary percentage progress before applying
// easing algorithm.
// it is always in range <0, 1> (0 <= arbitraryPercentage <= 1)
// NOTE: this value should NOT be used in most cases, because it will
// disable user from specifying Easing Algorithm and most use-cases
// does not want this. Exceptions, I see for now may be:
// - your animation does not accept negative (or larger than 1) progress values
// starter is a link to (*Animator).Start() method.
BuildAnimation(animationPercentage, arbitraryPercentage float32, starterFunc StarterFunc)
}