-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsequences.go
69 lines (55 loc) · 2.74 KB
/
sequences.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package main
import (
"time"
"github.com/TeamNorCal/animation"
)
// Define test sequences
// CreateTest1 creates a test sequence
func CreateTest1() *animation.Sequence {
var s1 = animation.Step{UniverseID: 0, Effect: animation.NewInterpolateSolidHexRGB(0xff0000, 0x00ff00, 3*time.Second)}
var s2 = animation.Step{UniverseID: 0, Effect: animation.NewInterpolateSolidHexRGB(0x00ff00, 0x0000ff, 3*time.Second)}
var s3 = animation.Step{UniverseID: 0, Effect: animation.NewInterpolateSolidHexRGB(0x0000ff, 0xff0000, 3*time.Second)}
var t1 = animation.Step{UniverseID: 1, Effect: animation.NewInterpolateSolidHexRGB(0xf4ab22, 0x22f445, 1*time.Second)}
var t2 = animation.Step{UniverseID: 1, Effect: animation.NewInterpolateToHexRGB(0xd122f4, 1*time.Second)}
var t3 = animation.Step{UniverseID: 1, Effect: animation.NewInterpolateToHexRGB(0xf4ab22, 1*time.Second)}
u1 := animation.Step{UniverseID: 2, Effect: animation.NewInterpolateToHexRGB(0xffffff, 1500*time.Millisecond)}
u2 := animation.Step{UniverseID: 2, Effect: animation.NewInterpolateToHexRGB(0x000000, 2*time.Second)}
// Test1 is a simple linear interpolation between successive colors
seq := animation.NewSequence()
seq.AddInitialStep("s1", &s1)
seq.AddStep("s2", &s2)
seq.AddStep("s3", &s3)
seq.CreateStepCycle("s1", "s2", "s3")
seq.AddInitialStep("t1", &t1)
seq.AddStep("t2", &t2)
seq.AddStep("t3", &t3)
seq.CreateStepCycle("t1", "t2", "t3")
seq.AddInitialStep("u1", &u1)
seq.AddStep("u2", &u2)
seq.CreateStepCycle("u1", "u2")
return seq
}
// CreateTest2 creates a sequence that runs animations in order across multiple universes
func CreateTest2() *animation.Sequence {
s1 := animation.Step{UniverseID: 0, Effect: animation.NewInterpolateSolidHexRGB(0x8d209f, 0x03f164, 2*time.Second)}
s2 := animation.Step{UniverseID: 1, Effect: animation.NewInterpolateSolidHexRGB(0x848953, 0x194847, 2*time.Second)}
s3 := animation.Step{UniverseID: 2, Effect: animation.NewInterpolateSolidHexRGB(0xabcdef, 0x654321, 2*time.Second)}
seq := animation.NewSequence()
seq.AddInitialStep("s1", &s1)
seq.AddStep("s2", &s2)
seq.AddStep("s3", &s3)
seq.CreateStepCycle("s1", "s2", "s3")
return seq
}
// CreateTest3 creates a pulse animation
func CreateTest3() *animation.Sequence {
s1 := animation.Step{UniverseID: 0, Effect: animation.NewDimmingPulse(animation.RGBAFromRGBHex(0x0000ff), 0.33, 4*time.Second)}
// s2 := animation.Step{UniverseID: 1, Effect: animation.NewInterpolateSolidHexRGB(0x848953, 0x194847, 2*time.Second)}
// s3 := animation.Step{UniverseID: 2, Effect: animation.NewInterpolateSolidHexRGB(0xabcdef, 0x654321, 2*time.Second)}
seq := animation.NewSequence()
seq.AddInitialStep("s1", &s1)
// seq.AddStep("s2", &s2)
// seq.AddStep("s3", &s3)
// seq.CreateStepCycle("s1", "s2", "s3")
return seq
}