Open felipemanga opened 8 years ago
Thanks Felipe, I'm not maintaining this any more the Spriter team has developed a much more complete JS runtime. I'll take a look a this change next week, unless you have a pull request available.
The official implementation has a bigger footprint compared to yours (requires goog.js, totalling 177KB vs just 8KB for this), and I got this working much more quickly. When all I need is to play back some simple animations, this is a much nicer solution.
Hello, I'm not sure if this lib's still being maintained, but it is of use to me and might be to others, so I'd like to document this here. I had some trouble with one of my animations, and the following seams to fix it:
in unmapFromParent, I added to the "s" object (after line 114): pivot_x : pos.pivot_x, pivot_y : pos.pivot_y,
in the tween function (line 137), do not default to 0: pivot_x : lerp( ao.pivot_x, bo.pivot_x, t), pivot_y : lerp( ao.pivot_y, bo.pivot_y, t),
Now, your draw callback can do the following: if( !isNaN(obj.pivot_x) ) sprite.anchor.x = obj.pivot_x; else sprite.anchor.x = file.pivot_x; if( !isNaN(obj.pivot_y ) ) sprite.anchor.y = obj.pivot_y; else sprite.anchor.y = file.pivot_y;