Set.animate(array) wont work as desired
Sorry about my english :O)
I try to animate a Set (Snap.js 0.5.1) with Set.animate(). In the Manual I can read ([http://snapsvg.io/docs/#Set.animate]) this:
// animate first element to radius 10, but second to radius 20 and in different time
set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);
In the manual I also can read, that I can pass an array of animations as the first argument like
Set.animate(arr)
but this doesn't work.
If I simply try
set.animate([{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]);
this woks well. But if I try
var arr = [[{r: 10}, 500, mina.easein], [{r: 20}, 1500, mina.easein]];
set.animate(arr);
will result in this Error
InvalidCharacterError: String contains an invalid character snap.svg.js:1000
I ask this question in stackoverflow but got no answer to solve this problem.
Is this a bug?
I added a comment to the SO question previously. Thinking more, I don't think it's a bug actually, it's the fact you are passing an array of arrays, instead of an array into the parameters, which is where I was leading before.
So I think this may work (as it will unfold the arrays into the parameter list...
set.animate.apply( set, arr );
eg http://jsfiddle.net/3nmL6tz1/