Hi everyone!
Working on a threejs project, so I need to animate an group of values or some Vector3. In tween I used to do but with gsap it dont work, what I'm doing wrong?
There are two cases.
1. Is there any difference betwenn an array or an obj?
// as Array
const startValues = { a: 0, b: 10, c: 20 }
// as Obj
const startValues = [ 0, 10, 20 ]
// as Array
const endValues = { a: 20, b: 50, c: 40 }
// as Obj
const endValues = [ 20, 50, 40 ]
gsap.to(startValues, {
endValues,
onUpdate() {
// How reach those values in both cases?
},
duration: 6
})
2.
const startValue = { a: new THREE.Vector3(0,0,0) }
gsap.to(startValue, {
a: new THREE.Vector3(1,10,5),
onUpdate() {
console.log( this.targets()[0].a ) // Logs me [Object object]
},
duration: 6
})
Thanks for helping!