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
| gsap.to(cube.position,{x:5,duration:5})
gsap.to(cube.rotation,{x:Math.PI*2,duration:5})
gsap.to(cube.position,{x:5,duration:5,ease:'power1.inOut'})
gsap.to(cube.position,{ x:5, duration:5, ease:'power1.inOut', onComplete:()=>{ console.log("动画完成") }, { onStart:()=>{ console.log("动画开始") } }})
gsap.to(cube.rotation,{x:Math.PI*2,duration:5,repeat:2})
gsap.to(cube.rotation,{x:Math.PI*2,duration:5,repeat:-1,yoyo:true})
gsap.to(cube.rotation,{x:Math.PI*2,duration:5,repeat:-1,yoyo:true,delay:2})
var animate1=gsap.to(cube.rotation,{x:Math.PI*2,duration:5,repeat:-1,yoyo:true}) window.addEventListener('click',()=>{ if(animate1.isActive()){ animate1.pause(); } else{ animate1.resume() } })
|