Hi,
I don't have a lot of experience with THREE so I can't do a lot to replicate your issue. Most likely this seems related to the fact that you're passing an object to GSAP in a way it can't be handled. You need to target the x property of the scale object.
One option I can think of is to create an array of objects that you can tween and use the onUpdate method to apply the changes to each cube element, but that would imply to loop through all the cubes in the callback in order to apply the scale values to each cube:
const scales = gltf.scene.children.map(cube => {
cube.castShadow = true;
cube.receiveShadow = true;
cube.scale.set(0.2, 0.2, 0.2);
return { x: 0.2 };
});
Then you can run GSAP with advanced staggers on that array:
gsap.to( scales, {
duration: 2,
x: 1,
stagger: {
amount: 0.1,
grid: "auto",
from: "center"
},
onUpdate: updateScales,
});
Sorry I can't be of more assistance, but this is not really a GSAP issue but a limitation of sorts in the way THREE (and most of the WebGL libraries I know for that matter) works when it comes to it's display objects/geometries.
Hopefully this helps.
Happy Tweening!