-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorb.scss
80 lines (61 loc) · 1.7 KB
/
orb.scss
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
// best in chrome
$total: 400; // total particles
$orb-size: 200px;
$particle-size: 4px;
$time: 15s;
$base-hue: 202; // change for diff colors (180 is nice)
body,
html {
height: 100%;
}
body {
background: black;
// overflow: hidden; // no scrollbars..
}
.wrap {
position : relative;
top : 50%;
left : 50%;
width : 0;
height : 0;
// perspective: 1000px;
animation : rotate $time infinite linear; // rotate orb
transform-style: preserve-3d;
}
@keyframes rotate {
100% {
transform: rotateY(360deg) rotateX(360deg);
}
}
.c {
position : absolute;
width : $particle-size;
height : $particle-size;
opacity : 0;
border-radius: 50%;
will-change : transform;
}
@for $i from 1 through $total {
$z : (random(360) * 1deg); // random angle to rotateZ
$y : (random(360) * 1deg); // random to rotateX
$hue: ((10/$total * $i) + $base-hue); // set hue
.c:nth-child(#{$i}) {
// grab the nth particle
animation : orbit#{$i} $time infinite;
// animation-delay: ($i * .0s);
background-color: hsla($hue, 100%, 50%, 1);
}
@keyframes orbit#{$i} {
0% {
transform: rotateZ(-$z) rotateY($y) translateX($orb-size) rotateZ($z); // form orb
opacity : 1; // fade in
}
100% {
transform: rotateZ(-$z) rotateY($y) translateX($orb-size) rotateZ($z); // hold orb state 30-80
opacity : 1; // hold opacity 20-80
}
100% {
// transform: rotateZ(-$z) rotateY($y) translateX( ($orb-size * 3) ) rotateZ($z); // translateX * 3
}
}
}