1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <style>
- #div1 {
- width: 200px;
- height: 200px;
- background: aqua;
- /* animation: name duration timing-function delay iteration-count direction fill-mode; */
- animation: run 5s ease 2s 2 forwards;
- /*
- animation 设置所有动画属性的简写属性。
- animation-delay 规定动画开始的延迟。
- animation-direction 定动画是向前播放、向后播放还是交替播放。
- animation-duration 规定动画完成一个周期应花费的时间。
- animation-fill-mode 规定元素在不播放动画时的样式(在开始前、结束后,或两者同时)。
- animation-iteration-count 规定动画应播放的次数。
- animation-name 规定 @keyframes 动画的名称。
- animation-play-state 规定动画是运行还是暂停。
- animation-timing-function 规定动画的速度曲线。
-
- */
- }
- @keyframes run {
- 10% {
- width: 800px
- }
- 50% {
- width: 150px;
- }
- 100% {
- width: 400px
- }
- }
- </style>
- </head>
- <body>
- <div id="div1"></div>
- </body>
- </html>
|