无法播放CSS3动画
我有下面的代码,我想做一些无法播放CSS3动画,css,css-animations,Css,Css Animations,我有下面的代码,我想做一些divbounce。现在他们似乎一点也不动,我哪里做错了 这里有一个 问题似乎在于如何在类中设置动画。您正在使用动画名称,但您声明的不仅仅是名称;您正在为动画迭代计数和动画持续时间添加值 请尝试: .bounceup { -webkit-animation: bounceup 2s infinite; animation: bounceup 2s infinite; } .bounceleft { -webkit-animation: bounceleft
div
bounce。现在他们似乎一点也不动,我哪里做错了
这里有一个
问题似乎在于如何在类中设置动画。您正在使用
动画名称
,但您声明的不仅仅是名称;您正在为动画迭代计数
和动画持续时间
添加值
请尝试:
.bounceup {
-webkit-animation: bounceup 2s infinite;
animation: bounceup 2s infinite;
}
.bounceleft {
-webkit-animation: bounceleft 2s infinite;
animation: bounceleft 2s infinite;
}
.bounceright {
-webkit-animation: bounceright 2s infinite;
animation: bounceright 2s infinite;
}
编辑:
似乎@Harry修改了他的评论,并准确地指出了上述内容。基本上,您试图使用动画
的速记版本,但用于动画名称
属性
另一种解决方案是(非速记版本):
我为您制作了一份工作副本:
-webkit-animation: bounceup 5s infinite;
animation: bounceup 5s infinite;
还有一个指向速记技巧的链接:
请演示一下。乍一看,我看不出有什么不对劲。(编辑:抱歉,您正在使用
动画名称
属性,该属性应仅用于设置动画名称,而不是使用速记动画
属性,这就是错误。)@Harry刚刚添加了一个小提琴。所以用动画替换动画名称?我更新了我对你的速记技巧的回答,它可以完美地看到我的小提琴
.bounceup {
animation-name: bounceup;
-webkit-animation-name: bounceup;
animation-duration: 2s;
-webkit-animation-duration: 2s;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
}
-webkit-animation: bounceup 5s infinite;
animation: bounceup 5s infinite;