想问一下关于动画前的姿态
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CSS3动画</title>
<style type="text/css">
body{
background:#abcdef;
}
div{
position:relative;
width:760px;
height:760px;
margin:auto;
-webkit-transform-style:preserve-3d;
-moz-transform-style:preserve-3d;
-o-transform-style:preserve-3d;
transform-style:preserve-3d;
}
div > div{
position:absolute;
width:100%;
height:100%;
top:0;
right:0;
bottom:0;
left:0;
margin:auto;
background-repeat:no-repeat;
background-position:center;
}
div > .inner{
background-image:url(images/circle_inner.png);
-webkit-animation-name:circle_inner;
animation-name:circle_inner;
-webkit-animation-duration:10s;
animation-duration:10s;
-webkit-animation-delay:2s;
animation-delay:2s;
/* -webkit-animation-iteration-count:5;
animation-iteration-count:5;*/
-webkit-animation-direction:alternate;
animation-direction:alternate;
-webkit-animation-fill-mode:both;
animation-fill-mode:both;
}
div > .middle{
background-image:url(images/circle_middle.png);
-webkit-animation-name:circle_middle;
animation-name:circle_middle;
-webkit-animation-duration:10s;
animation-duration:10s;
-webkit-animation-delay:2s;
animation-delay:2s;
/* -webkit-animation-iteration-count:5;
animation-iteration-count:5;*/
-webkit-animation-direction:alternate;
animation-direction:alternate;
-webkit-animation-fill-mode:both;
animation-fill-mode:both;
}
div > .outer{
background-image:url(images/circle_outer.png);
-webkit-animation-name:circle_outer;
animation-name:circle_outer;
-webkit-animation-duration:10s;
animation-duration:10s;
-webkit-animation-delay:2s;
animation-delay:2s;
/* -webkit-animation-iteration-count:5;
animation-iteration-count:5;*/
-webkit-animation-direction:alternate;
animation-direction:alternate;
-webkit-animation-fill-mode:both;
animation-fill-mode:both;
}
div > .imooc{
background-image:url(images/imooc.png);
}
@keyframes circle_inner{
form{transform:rotateX(90deg);}
to{transform:rotateX(315deg);}
}
@keyframes circle_middle{
form{transform:rotateY(90deg);}
to{transform:rotateY(315deg);}
}
@keyframes circle_outer{
form{transform:rotateZ(90deg);}
to{transform:rotateZ(-315deg);}
}
transform:rotate(0deg) scale(1);
-webkit-transition:transform 2s ease-in-out 1s;
-moz-transition:transform 2s ease-in-out 1s;
-o-transition:transform 2s ease-in-out 1s; /*写前面这三个是为了兼容一些老旧的浏览器*/
transition:transform 2s ease-in-out 1s;
}
</style>
</head>
<body>
<div>
<div class="inner"></div>
<div class="middle"></div>
<div class="outer"></div>
<div class="imooc"></div>
</div>
</body>
</html>这里我把开始角度改为了90度,设置的是both,但是延迟时间过了过后,还是充0度开始的,并没有充90度开始,想问一下,这个backwards(即both的动画前部分)怎么设置呢
8
收起
正在回答
2回答
同学你好, 可以设置animation-fill-mode: backwards 在下一次动画开启之前,保持动画的初始设置样式
老师这里以一个示例, 剩下的同学自己修改一下即可

如果还有疑惑, 可以再次提问, 我们会继续为你解答的
如果帮助到了你, 欢迎采纳!
祝学习愉快~~~
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星