-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
move_step.go
44 lines (35 loc) · 1.04 KB
/
move_step.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package animations
import "github.com/AllenDang/cimgui-go/imgui"
// MoveStep represents animation single key frame in context of MoveAnimation.
// If Relative() not set, positionDelta is relative to this in animation previous step.
type MoveStep struct {
positionDelta imgui.Vec2
isAbsolute bool
useBezier bool
bezier []imgui.Vec2
}
// Step creates animation new instance of MoveStep.
func Step(x, y float32) *MoveStep {
return &MoveStep{
positionDelta: imgui.Vec2{X: x, Y: y},
}
}
// StepVec acts same as Step but takes imgui.Vec2.
func StepVec(v imgui.Vec2) *MoveStep {
return &MoveStep{
positionDelta: v,
}
}
// Bezier allows to specify Bézier curve points.
// Points are relative to position specified in step.
func (m *MoveStep) Bezier(points ...imgui.Vec2) *MoveStep {
m.useBezier = true
m.bezier = points
return m
}
// Absolute tells animation to take position specified in this step as an absolute
// position rather than relative to he previous step.
func (m *MoveStep) Absolute() *MoveStep {
m.isAbsolute = true
return m
}