css3 动画相关
Published by powerfulyang on Nov 23, 2021
原来有 steps 这种东西呀
animation-timing-function
有如下可选值:
1/* Keyword values */
2animation-timing-function: ease;
3animation-timing-function: ease-in;
4animation-timing-function: ease-out;
5animation-timing-function: ease-in-out;
6animation-timing-function: linear;
7animation-timing-function: step-start;
8animation-timing-function: step-end;
9
10/* Function values */
11animation-timing-function: cubic-bezier(0.1, 0.7, 1.0, 0.1);
12animation-timing-function: steps(4, end);
13
14/* Steps Function keywords */
15animation-timing-function: steps(4, jump-start);
16animation-timing-function: steps(10, jump-end);
17animation-timing-function: steps(20, jump-none);
18animation-timing-function: steps(5, jump-both);
19animation-timing-function: steps(6, start);
20animation-timing-function: steps(8, end);
21
22/* Multiple animations */
23animation-timing-function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1);
24
25/* Global values */
26animation-timing-function: inherit;
27animation-timing-function: initial;
28animation-timing-function: revert;
29animation-timing-function: unset;
steps()
Relate to 张鑫旭的 blog
可以用于实现不连续的动画
Relate to stackoverflow
prefers-reduced-motion
媒体查询 prefers-reduced-motion 用于检测用户的系统是否被开启了动画减弱功能。
1.animation {
2 animation: vibrate 0.3s linear infinite both;
3}
4
5@media (prefers-reduced-motion: reduce) {
6 .animation {
7 animation: none;
8 }
9}