Skip to content

Commit d33cfdc

Browse files
authored
add animation durations (#550)
1 parent a624f90 commit d33cfdc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/extra/durations.css

+25
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
:where(html) {
2+
3+
/* Animation duration based on https://design.brainly.com/8adfd5f36/p/091f75-ux-motion */
4+
--duration-instant: 0ms; /* e.g. text change */
5+
--duration-quick-1: 80ms; /* e.g. checkbox, radio, hover */
6+
--duration-quick-2: 120ms; /* e.g. toggle, tab, chip, color, fade */
7+
--duration-moderate-1: 180ms; /* e.g. dropdown, tooltip */
8+
--duration-moderate-2: 260ms; /* e.g. modal, toast, dialog, notification */
9+
--duration-gentle-1: 320ms; /* e.g. bottom sheet, card expand */
10+
--duration-gentle-2: 420ms; /* e.g. advanced animations */
11+
12+
/*
13+
* Calculated animation duration based on https://design.brainly.com/8adfd5f36/p/091f75-ux-motion/t/page-091f75-75547432-5018fa-12
14+
* Demo: https://codepen.io/T3sT3ro/pen/RNwRLWx
15+
* unitless
16+
*/
17+
--animated-element-distance: 0;
18+
--animated-element-width: 0;
19+
--animated-element-height: 0;
20+
21+
/* Calculated animation duration in milliseconds */
22+
--duration-calculated: calc(((0.5 * var(--animated-element-distance, 0)) +
23+
(0.35 * var(--animated-element-width, 0)) +
24+
(0.3 * var(--animated-element-height, 0))) * 1ms);
25+
26+
/* Common time units */
227
--minute: 60s;
328
--hour: calc( 60 * var(--minute));
429
--day: calc( 24 * var(--hour));

0 commit comments

Comments
 (0)