如果您查看我的代码并运行它。
你会注意到笑脸不停地循环旋转180度的动画。我不想要这个效果,我只希望每次将鼠标悬停在黑色圆圈上时执行一次动画。我该怎么做?
@-webkit-keyframes circle {
from { transform:rotate(0deg); }
to { transform:rotate(180deg); }
}
@-webkit-keyframes inner-circle {
from { transform:rotate(0deg); }
to { transform:rotate(-180deg); }
}
#one {
position: absolute;
left: 500px;
top: 200px;
width:100px;
height:100px;
border-radius: 50px;
background-color: #000000;
}
#two {
width:100px;
height:100px;
margin: 0px auto 0;
color:orange;
font-size:100px;
line-height:1;
transform-origin:50% 200px;
}
#one:hover > div {
animation: circle 1s linear infinite;
-webkit-animation: circle 1s linear infinite;
}
#one:hover > div > div {
animation: inner-circle 1s linear infinite;
-webkit-animation: inner-circle 1s linear infinite;
}
</style>
<div id="one">
<div id="two"><div id="three">☻</div></div>
</div>
你会注意到笑脸不停地循环旋转180度的动画。我不想要这个效果,我只希望每次将鼠标悬停在黑色圆圈上时执行一次动画。我该怎么做?