前端 animation动画

2018-08-16  本文已影响0人  现实里的童话xklss

animation动画

lternate 原路,
0返回
infinite 无限次数不停
forwards 结束
both 起始和结束都设
animation-play-state: running; 鼠标移入开始动画
animation-play-state: paused; 鼠标移入停止
@keyframes 定义关键帧动画 moving 移动

<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>animation动画</title>
   <style type="text/css">
       .box{
           width: 100px;
           height: 100px;
           background-color: gold;
           animation: moving 1s ease 1s 5 alternate both;
           /*alternate 原路,0返回 infinite 无限次数不停 forwards 结束 both 起始和结束都设*/

       }
       .box:hover{
           animation-play-state: paused;
           /*animation-play-state: running; 鼠标移入开始动画*/
           /*animation-play-state: paused;  鼠标移入停止
           */
       }
           /*@keyframes 定义关键帧动画 moving 移动
           */
       @keyframes moving{
           from{
               width: 100px;
           }
           from{
               width: 500px;
           }
       }
   </style>
</head>
<body>
   <div class="box">
   
   </div>
</body>
</html>
上一篇 下一篇

猜你喜欢

热点阅读