本章的前提就是大家都知道动画的基本属性,例如animation-name、animation-duration、animation-timing-function、animation-delay、animation-iteration-count和animation-direction属性。了解更多animation相关的内容。现在制作一个左右抖动的动画效果,效果如下:在 uniapp 中,可以通过如下两种方式来完成。1. 直接使用 CSS 动画1.1 定义动画@keyframes shakeX {
from,
to {
transform: translate3d(0, 0, 0);
}
10%,
30%,
50%,
70%,
90% {
transform: translate3d(-10px, 0, 0);
}
20%,
40%,
60%,
80% {
transform: translate3d(10px, 0, 0);
}
}
.shakeX {
animation-name: shakeX;
animation-duration: 1s;
}1.2 使用.box {
width: 100rpx;
height: 100rpx;
background-co
...
继续阅读
(31)