【发布时间】:2021-11-03 11:48:50
【问题描述】:
我在 css 中找到了这个用于眨眼动画的代码笔。但我不明白他们为什么像这样使用 0%,100% 和 5%,95%。谁能解释一下为什么会这样?更改这些值会影响动画的速度。
* {
box-sizing: border-box;
}
.face {
display: flex;
justify-content: space-between;
width: 150px;
height: 200px;
padding: 30px;
background: tomato;
transition: .3s ease-in-out;
}
.face:hover {
background: green;
}
.eye {
background: white;
width: 15px;
height: 15px;
border-radius: 50%;
-webkit-transform-origin: 50%;
-webkit-animation: blink 5s infinite;
}
@-webkit-keyframes blink {
0%, 100% {
transform: scale(1, .05);
}
5%,
100% {
transform: scale(1, 1);
}
}
这里也是 codepen 链接:https://codepen.io/obaidnadeem/pen/rNwWexx
【问题讨论】:
标签: css animation css-animations