Hey guys!
Let me briefly explain what I want to do, where the problem is and what I already tried to fix it! Here’s the deal;
I’ve created a frame-by-frame (180 PNG’s) rendered animation, put those PNG’s into a .fla and created myself a nice “little” (8MB) .swf animation. The idea is that I can manipulate the timeline of this animation through the position of my mouse pointer;
position of pointer on the left side of the stage means that the animation will play backward, position the pointer in the middle, the animation stops and when you position the pointer on the right side of the stage, the animation plays forward (as regular). The animation is looped, so it will go on indefinitely.
Now, this all works, except for the occasional hiccup. The animation seems to run smoothly but every now and then it glitches a frame or two. This really damages the experience and beauty of the concept I’m trying to establish.
I’ve added a small fps/ms counter and it indeed shows a drop in frame-rate and a peak in the ms every now and then. This is not consistently happening on a single frame or anything, it seems rather random.
So I really thing this has something to do with the way I address/manipulate this loaded animation. What I’ve already tried is;
current method;
// used in the enter frame event
_animation.gotoAndStop(_animation.currentFrame + 1);
This seemed to be working the best so far (the least number of glitches). Perhaps it is a bit blunt? But to me it seemed to be the most straightforward solution.
previous methods;
-
I’ve tried to ‘tween’ the animation by creating a tween (using greensock’s TimeLineLite) and either ‘play’ the tween or ‘reverse’ the tween (according to the mouses position). This seemed to work properly, but I could not find a way to loop the tween both forward as well as backwards. The tween would loop indefinitely forwards, but when ‘reversing’ the tween, it would stop after the number of forward loops it had made. So if the animation made three whole loops forward, it would stop after three loops backward.
-
I’ve tried to ‘tween’ the frames of the animation using greesock’s tweenLite;
TweenLite.to(_animation, 1, {frame:_animation.currentFrame + 1, useFrames:true});
// or something in that order, can't remember.
Something like that, it worked, but it was glitchy as hell (obviously).
So yeah, if you are still with me here (tl;dr much? :joker:) any idea’s on what is the better solution? It’s not that my current solution is so buggy that it is unbearable, but I want to have it perfect.
Thank you for all you support!