-
Notifications
You must be signed in to change notification settings - Fork 0
/
animations.go
111 lines (93 loc) · 2.43 KB
/
animations.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package main
import (
"github.com/jpoz/glitch"
)
func glitchIt(gl *glitch.Glitch) {
for _, style := range config.Styles {
switch style {
case GlitchStyleTransposeInput:
glitchTransposeInput(gl)
case GlitchStyleVerticalTransposeInput:
glitchVerticalTransposeInput(gl)
case GlitchStyleCompressionGhost:
glitchCompressionGhost(gl)
case GlitchStyleGhostStreach:
glitchGhostStreach(gl)
case GlitchStyleHalfLifeLeft:
glitchHalfLifeLeft(gl)
case GlitchStyleHalfLifeRight:
glitchHalfLifeRight(gl)
case GlitchStyleChannelShiftLeft:
glitchChannelShiftLeft(gl)
case GlitchStyleChannelShiftRight:
glitchChannelShiftRight(gl)
case GlitchStyleBlueBoost:
glitchBlueBoost(gl)
case GlitchStyleGreenBoost:
glitchGreenBoost(gl)
case GlitchStyleRedBoost:
glitchRedBoost(gl)
case GlitchStylePrismBurst:
glitchPrismBurst(gl)
case GlitchStyleNoise:
glitchNoise(gl)
}
}
}
func glitchTransposeInput(gl *glitch.Glitch) {
width, height := gl.Bounds.Max.X, gl.Bounds.Max.Y
w, h := generateWidthAndHeight(width, height)
gl.TransposeInput(w, h, config.TransposeInput)
}
func glitchVerticalTransposeInput(gl *glitch.Glitch) {
width, height := gl.Bounds.Max.X, gl.Bounds.Max.Y
w, h := generateWidthAndHeight(width, height)
gl.VerticalTransposeInput(w, h, config.VertitalTransposeInput)
}
func glitchCompressionGhost(gl *glitch.Glitch) {
gl.CompressionGhost()
}
func glitchGhostStreach(gl *glitch.Glitch) {
gl.GhostStreach()
}
func glitchHalfLifeLeft(gl *glitch.Glitch) {
width, height := gl.Bounds.Max.X, gl.Bounds.Max.Y
w, h := generateWidthAndHeight(width, height)
if width < height {
gl.HalfLifeLeft(w, width)
} else {
gl.HalfLifeLeft(h, height)
}
}
func glitchHalfLifeRight(gl *glitch.Glitch) {
width, height := gl.Bounds.Max.X, gl.Bounds.Max.Y
w, h := generateWidthAndHeight(width, height)
if width < height {
gl.HalfLifeRight(w, width)
} else {
gl.HalfLifeRight(h, height)
}
}
func glitchChannelShiftLeft(gl *glitch.Glitch) {
gl.ChannelShiftLeft()
}
func glitchChannelShiftRight(gl *glitch.Glitch) {
gl.ChannelShiftRight()
}
func glitchBlueBoost(gl *glitch.Glitch) {
gl.BlueBoost()
}
func glitchGreenBoost(gl *glitch.Glitch) {
gl.GreenBoost()
}
func glitchRedBoost(gl *glitch.Glitch) {
gl.RedBoost()
}
func glitchPrismBurst(gl *glitch.Glitch) {
gl.PrismBurst()
}
func glitchNoise(gl *glitch.Glitch) {
r, g, b := generateRGB()
a := generateRandomNumber(1, 600)
gl.Noise(r, g, b, float64(a))
}