SuperGP
SuperGP
  • 发布:2022-10-25 17:07
  • 更新:2022-10-25 17:07
  • 阅读:192

【报Bug】createAnimation多动画干扰问题

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 12.4 (21F79)

浏览器平台: Chrome

浏览器版本: 104.0.5112.101(正式版本) (x86_64)

项目创建方式: CLI

CLI版本号: 2.0.1-35320220729002

示例代码:
<template>  
  <div class="sge">  
    <view  
      :animation="eggAnimationData"  
      @click="rotateAndScale"  
    >  
      <img  
        :src="eggsimg"  
        class="egg"  
        alt=""  
      >  
    </view>  
    <view  
      :animation="czAnimationData"  
      class="cz"  
    >  
      <img  
        src="https://appimg.super0.net/zjdcz.png"  
        alt=""  
      >  
    </view>  

  </div>  
</template>  

<script>  
export default {  
  name: "ScrmH5SmashGoldenEggs",  

  data() {  
    return {  
      eggsimg: "https://appimg.super0.net/zjdopen.png",  
      eggAnimationData: {},  
      czAnimationData: {},  
    };  
  },  

  mounted() {  
    this.$nextTick(() => {  
      var animation = uni.createAnimation({  
        transformOrigin: "50% 50%",  
        duration: 20,  
        timingFunction: "ease",  
      });  

      this.animation = animation;  
    });  
  },  

  methods: {  
    rotateAndScale: function (e) {  
      this.animation.opacity(1).step({ duration: 300 });  
      this.animation  
        .rotateZ(80)  
        .step({ transformOrigin: "80% 80%", duration: 600 });  
      this.animation  
        .rotateZ(-50)  
        .step({ transformOrigin: "80% 80%", duration: 200 });  
      this.czAnimationData = this.animation.export();  
      setTimeout(() => {  
        this.animation.rotateZ(-50).step();  
        // this.animation.opacity(0).step();  
        this.czAnimationData = this.animation.export();  
      }, 1200);  
      setTimeout(() => {  
        this.animation.currentTransform = [];  
        for (let i = 0; i < 7; i++) {  
          this.animation.translate(5).step();  
          this.animation.translate(-5).step();  
        }  
        this.animation.translate(0).step();  
        this.eggAnimationData = this.animation.export();  
      }, 1800);  

      setTimeout(() => {  
        // this.$emit("result", e);  
      }, 1000);  
    },  
  },  
};  
</script>  

<style lang="scss" scoped>  
.sge {  
  position: relative;  
  display: flex;  
  justify-content: center;  
  align-items: center;  
  .egg {  
    width: 600rpx;  
  }  
  .cz {  
    position: absolute;  
    width: 200rpx;  
    right: 60rpx;  
    top: 60rpx;  
    opacity: 0;  
    img {  
      width: 100%;  
    }  
  }  
}  
</style>  

操作步骤:

点击方法执行动画小锤子会被偏移

预期结果:

两段动画互不干扰

实际结果:

会被干扰

bug描述:

多view窗口需要动画时 会互相干扰下层动画回干扰到上层就是指最后一段执行的动画回把上面的也一起被执行

2022-10-25 17:07 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复