两段序列帧动画播放,在ios机型上出现闪屏

使用场景:两段序列帧动画连接播放,先播放第一段播一次,再播放第二段,第二段循环播放,在ios机型上出现动画闪动,播放不正常。

错误的写法:把每一段序列帧动画单独写在了定义的动画里

.gacha-bg {
  width: 750rpx;
  height: 1000rpx;
  animation: gacha 1.6s steps(22), xing 2s steps(27);
  animation-delay: 0.8s, 2.4s;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards, forwards;
}

@keyframes gacha {
  0% {
    background-image: url('1.jpg');
    background-size: 17250rpx;
    background-repeat: no-repeat;
    background-position: 0;
  }
  100% {
    background-image: url('1.jpg');
    background-size: 17250rpx;
    background-repeat: no-repeat;
    background-position: -16500rpx;
  }
}

@keyframes xing {
  0% {
    background-image: url('bg.jpg');
    background-size: 21000rpx;
    background-repeat: no-repeat;
    background-position: 0;
  }
  100% {
    background-image: url('bg.jpg');
    background-size: 21000rpx;
    background-repeat:no-repeat;
    background-position: -20250rpx 0;
  }
}

修改后: 

背景图需要统一写一遍,由于第二段要循环播放,所以需要在定义的第二段动画里写上图片信息

.gacha-bg {
  width: 750rpx;
  height: 1000rpx;
  animation: gacha 1.6s steps(22), xing 2s steps(27);
  animation-delay: 0.8s, 2.4s;
  animation-iteration-count: 1, infinite;
  animation-fill-mode: forwards, forwards;
  background-image: url('1.jpg'),url('bg.jpg');
  background-size: 17250rpx,21000rpx;
  background-repeat: no-repeat,no-repeat;
}

@keyframes gacha {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: -16500rpx 0;
  }
}

@keyframes xing {
  0% {
    background-image: url('bg.jpg');
    background-size: 21000rpx;
    background-repeat: no-repeat;
    background-position: 0 0;
  }
  100% {
    background-image: url('bg.jpg');
    background-size: 21000rpx;
    background-repeat: no-repeat;
    background-position: -20250rpx 0;
  }
}

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 18:54:06       5 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 18:54:06       5 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 18:54:06       4 阅读
  4. Python语言-面向对象

    2024-07-10 18:54:06       7 阅读

热门阅读

  1. GPT-5或重塑我们的工作与生活

    2024-07-10 18:54:06       9 阅读
  2. Soul App Android一二三面凉经(2024)

    2024-07-10 18:54:06       9 阅读
  3. leetcode-动态规划-01背包

    2024-07-10 18:54:06       11 阅读
  4. 软件开发面试题C#,.NET知识点(续)

    2024-07-10 18:54:06       12 阅读
  5. git命令获取当前分支远端分支名

    2024-07-10 18:54:06       12 阅读
  6. oracle查询出表中某几个字段值不唯一的数据

    2024-07-10 18:54:06       12 阅读
  7. Git 常用命令

    2024-07-10 18:54:06       7 阅读
  8. C#规则引擎

    2024-07-10 18:54:06       10 阅读
  9. 深度学习Day-24:ResNeXt-50算法思考

    2024-07-10 18:54:06       10 阅读
  10. 完全背包求具体方案(c++题解)

    2024-07-10 18:54:06       10 阅读
  11. Pull Request

    2024-07-10 18:54:06       10 阅读
  12. stm32使用硬件SPI

    2024-07-10 18:54:06       8 阅读
  13. Elasticsearch7.10集群搭建

    2024-07-10 18:54:06       8 阅读