-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Animation.go
38 lines (28 loc) · 637 Bytes
/
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
30
31
32
33
34
35
36
37
38
package scarlet
import "strings"
// Force interface implementation
var _ Renderable = (*Animation)(nil)
// Animation ...
type Animation struct {
Name string
Keyframes []*CSSRule
}
// Render renders the animation to the output stream.
func (anim *Animation) Render(output *strings.Builder, pretty bool) {
output.WriteString("@keyframes ")
output.WriteString(anim.Name)
if pretty {
output.WriteByte(' ')
}
output.WriteByte('{')
if pretty {
output.WriteByte('\n')
}
for _, keyframe := range anim.Keyframes {
keyframe.Render(output, pretty)
}
output.WriteByte('}')
if pretty {
output.WriteByte('\n')
}
}