juliangarnier / anime

JavaScript animation engine
https://animejs.com
MIT License
50.4k stars 3.68k forks source link

JAVASCRIPT Nested OBJECT #865

Open AmirRafiee opened 1 year ago

AmirRafiee commented 1 year ago

i want to animate javascript object with nested object. currently we can animate root properties but when we get deeper in to the object we cant animate the values. i think this will be pretty handy if we were able to do such.

sample code :

var Rect= { width: 100, height: 100, position: { x: 10, y: 10 } } anime({ targets: Rect, width: 200, height: 200, "position.x": 100, "position.y": 100, round: 1, easing: 'linear' });

juliangarnier commented 11 months ago

This is not possible out of the box in JS, but maybe you can create a proxy object with getter and setter props that will update the original object?