[Html5基础训练]animation的step使用方法

html 复制代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Sprite Demo</title>
    <style>
      #an {
        width: 128px;
        height: 128px;
        background: url(img/spriteB.png);        
        animation: move infinite 4s steps(8,end);
      }
      /* -254,-384  x-1152  1024-128=    896 */
      @keyframes move {
        0% {
          background-position:0 -256px;
        }
        50% {
          background-position:-1024px -256px;
        } 
        50.001% {
          background-position:0 -384px;
        }
        100% {
          background-position:-1024px -384px;
        }        
        
      }
    </style>
  </head>
  <body>
    <div id="an"></div>
  </body>
</html>

SpriteB图片下载:

相关推荐
C澒17 分钟前
前端监控系统的最佳实践
前端·安全·运维开发
xiaoxue..20 分钟前
React 手写实现的 KeepAlive 组件
前端·javascript·react.js·面试
摘星编程24 分钟前
在OpenHarmony上用React Native:自定义useHighlight关键词高亮
javascript·react native·react.js
hhy_smile26 分钟前
Class in Python
java·前端·python
小邓吖1 小时前
自己做了一个工具网站
前端·分布式·后端·中间件·架构·golang
南风知我意9571 小时前
【前端面试2】基础面试(杂项)
前端·面试·职场和发展
LJianK11 小时前
BUG: Uncaught Error: [DecimalError] Invalid argument: .0
前端
2601_949613021 小时前
flutter_for_openharmony家庭药箱管理app实战+用药知识详情实现
android·javascript·flutter
No Silver Bullet2 小时前
Nginx 内存不足对Web 应用的影响分析
运维·前端·nginx
一起养小猫2 小时前
Flutter for OpenHarmony 实战 表单处理与验证完整指南
android·开发语言·前端·javascript·flutter·harmonyos