|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- <!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>
- body{
- background-color: rgb(175, 194, 211);
- }
- div{
- position: absolute;
- width: 200px;
- height: 100px;
- /*
- 元素可以添加多个动画,用逗号分隔
- */
- background: url(https://img-blog.csdnimg.cn/9811146e174b4d8f940d8b92cf2b4c94.png) no-repeat 0 0;
- animation: bear 2s steps(8) infinite,move 5s linear forwards;
- }
- @keyframes bear{
- 0%{
- }
- 100%{
- background: url(https://img-blog.csdnimg.cn/9811146e174b4d8f940d8b92cf2b4c94.png) no-repeat -1600px 0;
- }
-
- }
- @keyframes move {
- 0%{
- left: 0;
- }
- 50%{
- left: 50%;
- margin-left: -100px;
- }
- }
- </style>
- </head>
- <body>
- <div></div>
- </body>
- </html>
复制代码
将move动画中的50%修改为100%即可,forwards停留在最后一帧指的是动画100%的时候
|
|