全栈开发技术分享
首页
👉 CSS大揭秘 👈
  • 目录
  • 分类
  • 标签
  • 归档
  • Vue
  • JavaScript
  • 微信开发
  • 移动端H5调试工具
  • 国内十大前端团队网站
  • Nodejs
  • Egg
  • 环境搭建
  • 运维面板
  • 域名配置
  • Nginx
  • 收藏
  • 常用工具
  • 实用技巧
  • 常用命令
  • 友情链接
关于

Dreaming Lee 🍍 ҉҉҉҉҉҉҉҉

开发小菜鸡
首页
👉 CSS大揭秘 👈
  • 目录
  • 分类
  • 标签
  • 归档
  • Vue
  • JavaScript
  • 微信开发
  • 移动端H5调试工具
  • 国内十大前端团队网站
  • Nodejs
  • Egg
  • 环境搭建
  • 运维面板
  • 域名配置
  • Nginx
  • 收藏
  • 常用工具
  • 实用技巧
  • 常用命令
  • 友情链接
关于
  • 边框

    • 1px边框
  • 视觉效果

    • 文字效果

      • 文字渐变色
      • 展示小于12px文字
      • 超出展示省略号
    • 进度条

      • 按钮进度条
  • 布局

    • 水平垂直居中
  • 动画

    • 小手动画
  • 其他

    • CSS设置滚动条样式
  • CSS
  • 动画
Dreaming Lee 🍍 ҉҉҉҉҉҉҉҉
2021-07-08

小手动画

# 通过 background-size、background-position 和 animation-timing-function: steps 配合实现。

# 图片大小4520 * 89,共40个小图,单个小图大小113 * 89,分别对应:
  • width: 113px; height: 89px;
  • background-size: 4570px 89px;
  • 动画结束状态 to { background-position: -4570px 0; }
  • animation-timing-function: steps(40, end);
点击播放
<template>
  <div class="demo-AnimateFinger">
    <span>点击播放</span>
    <i class="finger"></i>
  </div>
</template>

<script>
export default {
  name: 'AnimateFinger',
}
</script>

<style lang="scss" scoped>
.demo-AnimateFinger {
  width: 240px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background-color: #f2571e;
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 4px;
  border-radius: 24px;
  margin: 40px auto 50px;
  cursor: pointer;
  .finger {
    width: 113px;
    height: 89px;
    background: url(//cdn.1024vip.cn/tech/images/202107/ec07fb0edb42d439473c9f974477b774.png) no-repeat;
    background-position: 0;
    background-size: 4570px 89px;
    animation: hand-bounce 1150ms steps(40, end) infinite;
    position: absolute;
    right: -25px;
    top: -6px;
  }
  @keyframes hand-bounce {
    to {
      background-position: -4570px 0;
    }
  }
}
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
上次更新: 2021-07-08 10:53:30
水平垂直居中
CSS设置滚动条样式

← 水平垂直居中 CSS设置滚动条样式→

最近更新
01
【uniapp】字节小程序BUG - “navigateToMiniProgram/getUserProfile:fail must be invoked by user tap gesture”
06-21
02
七牛云上传自有证书
04-27
03
使用腾讯云申请免费SSL证书
04-27
更多文章>
Theme by Vdoing | Copyright © 2020-2024 | 豫ICP备2020030395号 | 靳立祥 | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式