-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy path_animation.scss
121 lines (106 loc) · 2.44 KB
/
_animation.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
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
112
113
114
115
116
117
118
119
120
121
@mixin animation-helper-classes() {
@keyframes in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes in-down {
0% {
opacity: 0;
transform: translate3D(0, -5px, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-up {
0% {
opacity: 0;
transform: translate3D(0, 5px, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-right {
0% {
opacity: 0;
transform: translate3D(-5px, 0, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-left {
0% {
opacity: 0;
transform: translate3D(5px, 0, 0);
}
100% {
opacity: 1;
transform: translate3D(0, 0, 0);
}
}
@keyframes in-scale {
0% {
opacity: 0;
transform: scale3D(0.95, 0.95, 1);
}
100% {
opacity: 1;
transform: scale3D(1, 1, 1);
}
}
// allows animation trigger via JS by adding class to element
.calcite-animate {
opacity: 0;
animation-fill-mode: both;
animation-duration: var(--calcite-animation-timing);
}
// specify animation
.calcite-animate__in {
animation-name: in;
}
.calcite-animate__in-down {
animation-name: in-down;
}
.calcite-animate__in-up {
animation-name: in-up;
}
.calcite-animate__in-right {
animation-name: in-right;
}
.calcite-animate__in-left {
animation-name: in-left;
}
.calcite-animate__in-scale {
animation-name: in-scale;
}
}
@mixin animation-base() {
--calcite-animation-timing: calc(150ms * var(--calcite-internal-duration-factor));
--calcite-internal-duration-factor: var(--calcite-duration-factor, 1);
--calcite-internal-animation-timing-fast: calc(100ms * var(--calcite-internal-duration-factor));
--calcite-internal-animation-timing-medium: calc(200ms * var(--calcite-internal-duration-factor));
--calcite-internal-animation-timing-slow: calc(300ms * var(--calcite-internal-duration-factor));
}
@mixin animation-reduced-motion() {
@media (prefers-reduced-motion: reduce) {
:root {
--calcite-internal-duration-factor: 0;
}
}
}
/* helper to properly scale internal durations */
@function scale-duration($animation-var, $factor) {
@return calc(
calc(var($animation-var) / var(--calcite-internal-duration-factor)) *
calc($factor / var(--calcite-internal-duration-factor))
);
}