[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图片下载:

相关推荐
郑寿昌1 小时前
IIoT本体迁移的领域扩展机制
服务器·前端·microsoft
深海鱼在掘金1 小时前
Next.js从入门到实战保姆级教程(第十一章):错误处理与加载状态
前端·typescript·next.js
深海鱼在掘金1 小时前
Next.js从入门到实战保姆级教程(第十二章):认证鉴权与中间件
前端·typescript·next.js
energy_DT2 小时前
2026年十五五油气田智能增产装备数字孪生,CIMPro孪大师赋能“流动增产工厂”三维可视化管控
前端
龙猫里的小梅啊2 小时前
CSS(四)CSS文本属性
前端·css
MXN_小南学前端2 小时前
watch详解:与computed 对比以及 Vue2 / Vue3 区别
前端·javascript·vue.js
饭小猿人2 小时前
Flutter实现底部动画弹窗有两种方式
开发语言·前端·flutter
让学习成为一种生活方式2 小时前
pbtk v 3.5.0安装与使用--生信工具084
前端·chrome
heimeiyingwang2 小时前
【架构实战】FinOps云成本优化实践
前端·chrome·架构
Mr Xu_3 小时前
从后端数据到前端图表:深入解析 reduce 与 flatMap 的数据整形实战
前端·javascript