0
我想用CSS制作动画。它应该旋转图像并给它一个脉冲(类似于Shazam的按钮动画)。 以下是我的代码。图像是旋转的,但如果我添加“比例”来尝试并使其脉动,它有一个脉冲但不旋转。带有脉冲的CSS旋转动画
.animated {
animation-duration: 5s;
-webkit-animation-duration: 5s;
animation-fill-mode: none;
-webkit-animation-fill-mode: none;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
}
@keyframes rotate {
0% {
/*transform: scale(1);*/
transform-origin: center center;
transform: rotate(-360deg);
}
50% {
/*transform: scale(1.1);*/
transform-origin: center center;
}
100% {
/*transform: scale(1);*/
transform-origin: center center;
transform: rotate(0);
}
}
@-webkit-keyframes rotate {
0% {
/*-webkit-transform: scale(1);*/
-webkit-transform-origin: center center;
-webkit-transform: rotate(-360deg);
}
50% {
/*-webkit-transform: scale(1.1);*/
-webkit-transform-origin: center center;
}
100% {
/*-webkit-transform: scale(1);*/
-webkit-transform-origin: center center;
-webkit-transform: rotate(0);
}
}
.rotate {
animation-name: rotate;
-webkit-animation-name: rotate;
}
有人能帮忙吗?
您可以加入您的HTML代码,因为它是给你一个解决方案很重要? – Persijn
你的代码既没有告诉我们你如何在'.animated'元素上设置'rotate'关键帧,也没有告诉你如何添加'pulse'。 – BillyNate