-
Notifications
You must be signed in to change notification settings - Fork 1
/
dots.go
48 lines (36 loc) · 784 Bytes
/
dots.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
package typing
import (
"github.com/diamondburned/cchat-gtk/internal/ui/primitives"
"github.com/gotk3/gotk3/gtk"
)
var dotsCSS = primitives.PrepareCSS(`
@keyframes breathing {
0% { opacity: 0.66; }
100% { opacity: 0.12; }
}
label {
animation: breathing 800ms infinite alternate;
}
label:nth-child(1) {
animation-delay: 000ms;
}
label:nth-child(2) {
animation-delay: 150ms;
}
label:nth-child(3) {
animation-delay: 300ms;
}
`)
const breathingChar = "●"
func NewDots() *gtk.Box {
b, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
primitives.AddClass(b, "breathing-dots")
for i := 0; i < 3; i++ {
c, _ := gtk.LabelNew(breathingChar)
c.Show()
primitives.AttachCSS(c, dotsCSS)
primitives.AttachCSS(c, smallfonts)
b.Add(c)
}
return b
}