简体   繁体   中英

GSAP 3+ Tweening values in an array

My use case for this tween is to animate the morphTargetInfluences of an object in THREE.js. The influences are represented as an array like [0, 1] .

For simplicity, a mesh is represented like so:

mesh = {
  morphTargetInfluences: [0, 1]
}

In GSAP 2.0, I could tween this value like so:

const target = [1, 0];
TweenMax.to(mesh.morphTargetInfluences, 0.5, { ...target });

However with the new API I get a gsData is undefined error. Is there a new way to tween array values?

tl.to(firstArray, duration, secondArray); In your case and mine too : tl.to(mesh.morphTargetInfluences, 0.2, targets);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM