b-g / Ani

A lightweight animation library for the programming environment Processing
79 stars 13 forks source link

Not working with an array inside a class? #16

Closed dandaka closed 8 years ago

dandaka commented 8 years ago

Benedikt,

I'm trying to use Ani with Hype to animate things. But Hype is not relevant for this error. I can't get to animate variables inside an array in a class. Here is log and source code:

https://github.com/deepower/p-visuals/blob/8c3d50d65c14b95da7b7f238172f99dff8aa8d3f/hype_ani/hype_ani.pde#L41-L43

Same code works with a variable, but doesn't work with same variable inside an array. I expect s.anims[s.apos] has same value as alpha, but it doesn't get affected by Ani.

https://gist.github.com/dandaka/0f6eba3971db74ea938b

Any ideas how to fix that? Thank you!

b-g commented 8 years ago

Hi @dandaka, I'm sorry but ani does not work with arrays. The only "shortcut syntax" is http://benedikt-gross.de/libraries/Ani/examples/Ani_Propertylist/Ani_Propertylist.pde. This feature is not planned and to be hones I also don't find it useful. I would rather consider to refactor it to an array of objects, where the object holds "inside" the animation logic ... see http://benedikt-gross.de/libraries/Ani/examples/Ani_in_Classes/Ani_in_Classes.pde. All the best + good luck, B

dandaka commented 8 years ago

Thank you for letting me know :+1: