Hi all,
I'm new to GSAP, but it looks very cool and is almost perfect for my application.
I have an object with a 3D position "property", but that uses getters and setters, and returns a copy of the array in the getter.
object.position([x, y, z]);
var zval = object.position()[2]; // getter returns internalpos.slice()
My ideal syntax would be something like this:
TweenMax.to(object, 1, {position: [x, y, z]});
This doesn't work as arrays will need some special handling to do element-wise manipulation which GSAP doesn't do by default.
If the position property was the array itself, then either of these would work:
TweenMax.to(object.position, 1, [x, y, z]);
TweenMax.to(object.position, 1, {endArray: [x, y, z]}); // Using EndArrayPlugin
Unfortunately with the getter returning a copy, there is no way to get a reference to the internal array object, so no way that I can see of using GSAP directly. It would also be nice to be able to list multiple properties in the same tween.
So I probably could rustle up a plugin to handle "position", etc, specifically. But I wonder if it would be possible to make that more generic. Perhaps syntax like this could work:
TweenMax.to(object, 1, {arrays: {position: [0, 1, 2], rotation:[0, 0, 0]}});
Any thoughts? Is the above going to be possible with a plugin, and could it reuse the existing GSAP magic for detecting raw properties vs getters/setters?
Simon