b***@163.com
b***@163.com
  • 发布:2023-10-13 19:44
  • 更新:2025-06-30 17:15
  • 阅读:550

请教下 gsap 在uniappAPP端怎么正常运行,我做的矿工小游戏

分类:uni-app

视频里面是正常使用代码

  this.gouzi_line = gsap.to(".gouzi_line" , {  
                            duration: this.swing_speed,  
                            rotation: 60,  
                            ease: "power1.inOut",  
                            repeat: Infinity,  
                            yoyo: true  
                        })

但是上面的代码不能再APP内运行

uni.createSelectorQuery()  
                      .in(this)  
                      .select("#gouzi_line")  
                      .boundingClientRect()  
                      .exec((res) => {  
                        const element = res[0]; // Get the first result  
                        if (element) {  
                        this.gouzi_line = gsap.to(element , {  
                            duration: this.swing_speed,  
                            rotation: 60,  
                            ease: "power1.inOut",  
                            repeat: Infinity,  
                            yoyo: true  
                        })  
                        } else {  
                          console.error("Element not found");  
                        }  
                      });

我换成了这段代码也不行 有么有人能给个好办法

2023-10-13 19:44 负责人:无 分享
已邀请:
1***@163.com

1***@163.com

楼主解决了吗

要回复问题请先登录注册