| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <style>
- .box{
- width: 200px;
- height: 200px;
- background-color: red;
- font-size: 100px;
- text-align: center;
- line-height: 200px;
- color: #fff;
- font-weight: bold;
- position: absolute;
- top:0;
- left:0;
- /* 动画 animation */
- /* animation 后面的参数为 动画名称 动画时间 动画曲线 动画延迟 动画次数 动画结束状态 (forwards 保持最后帧) */
- /* animation: move 1s linear 2s 2 forwards ; */
- /* 动画名称 用来定义动画关键帧(动画名称) */
- animation-name: move;
- /* 动画时间 用来定义动画的持续时间 */
- animation-duration: 1s;
- /* 动画曲线 用来定义动画的运动轨迹 */
- animation-timing-function: linear;
- /* 动画延迟 用来定义动画的延迟时间 */
- animation-delay: 2s;
- /* 动画次数 用来定义动画的次数 infinite 无限循环 */
- animation-iteration-count: infinite;
- /* 动画结束状态 用来定义动画的结束状态 */
- animation-fill-mode: forwards;
- }
- /* @keyframes 用来定义动画关键帧(动画名称) */
- /* 这里动画名称可以任意起名字 */
- /* 动画关键帧 用来定义动画的运动轨迹 */
- /* 这里from和to是开始和结束 */
-
- @keyframes move{
- /* from{
- left:0;
- }
-
- to{
- left:200px;
- } */
- 0%{
- left:0;
- }
- 50%{
- left:100px;
- }
- 100%{
- top:100px;
- background-color: blue;
- }
- }
- .box:hover{
- animation-play-state: paused;
- }
- </style>
- </head>
- <body>
- <div class="box">
- 中
- </div>
- </body>
- </html>
|