Hello ,我've an issue with an animation in CSS, I'我试图在CSS中制作"3d"翻转卡动画 . 我已经有了一个工作版本,但在这个版本上,这张卡只旋转了一次,但我想制作一个动画,旋转/缩放/等...
Here is the function I use to rotate the card :
function test() {
var sheet = window.document.styleSheets[0]
/* Working */
//sheet.insertRule('.flip-container .flipper{-webkit-transform: rotateY(-180deg);-moz-transform: rotateY(-180deg);-o-transform: rotateY(-180deg);transform: rotateY(-180deg);-webkit-transform: rotateY(-180deg);}', sheet.cssRules.length);
/* Isn't working */
sheet.insertRule('.flip-container .flipper{animation-name: test; animation-duration: 1.5s; animation-delay: 0.1s;}', sheet.cssRules.length);
}
第一个版本按下按钮时工作 add css -webkit-transform: rotation rules in the css file ,使卡片翻转,一切正常 . https://jsfiddle.net/3Lnt4fe3/4/
在css文件中没有工作的第二个版本 add css animation-name rule in the css file 已经声明了@keyframe . 动画运行良好但是当它结束时,旋转被取消... https://jsfiddle.net/3Lnt4fe3/5/
有人可以帮我阻止取消动画吗? Thanks
1 回答
你需要添加
animation-fill-mode: forwards
才能按照你想要的方式工作: