Hey, I have a problem. The fact is that this library does not expect you to use multiple animations at a time. the SKEL.EFFECTS.Slide.animate function, which in the animation creates a field in the animated object, called skel_animate_id, which is actually the identifier of the timer configured for the animation.
Since this library does not expect several animations at a time when you create a new animation, it just does element.skel_animate_id = setInterval(..... , and if you follow me, you will understand that everything that was on skel_aimate_id before (i.e. the library refers only to any previous animation timers) is lost after this assignment.
Now there is a step function called by timers, which is responsible for recognizing when the animation has finished, and stop the timer itself, but it does this by calling clearInterval(element.skel_animate_id); that, obviously, will only clear the timer associated with the last animated attribute.
In short, when you call the second animation of the attributes (until the first end), you leave an open timer that continues to move and "animates" the first attribute (that is, sets its final value to it).
EDIT: Live patch demonstration.
DESTINY OF VILLA
Lines [488-531]
SKEL.EFFECTS.Slide = { counter: 0, fps: 50, //handles the animation from an attribute to an attribute animate: function(element,cssAttribute,from,to,duration,transition){ if(element.css('display') != 'block'){ element.skel_old_display = element.css('display'); } //if there isn't a default transition set one if(!transition){ transition = SKEL.Transitions.quadOut; } //cancel any current animation // FELIX Note: I've commented this because when we had 3 transitions on the same element, this function would make only the first one to work. //SKEL.EFFECTS.Slide.stop(element); var startTime = new Date().getTime(); //IE doesn't support arguments, so make a function that explicitly calls with those arguments element.skel_animate_id = setInterval(function(){ SKEL.EFFECTS.Slide.step(element,cssAttribute,from,to,duration,startTime,transition); },(1000/SKEL.EFFECTS.Slide.fps)); return element.skel_animate_id; }, //cancels any animation event stop: function(element){ //console.log(this,element,element.skel_animate_id); //console.log(element.skel_animate_id); if(element.skel_animate_id){ clearInterval(element.skel_animate_id); element.skel_animate_id = 0; if(element.skel_old_display){ element.css('display',element.skel_old_display); } } },
POSSIBLE SOLUTION
I would have skel_animate_ids as an array and save each interval with a link to an animated attribute, so the step function indicates which interval will be cleared.
at SKEL.EFFECTS.Slide.animate
if (!element.skel_animate_ids){ element.skel_animate_ids = new Object(); }
then to SKEL.EFFECTS.Slide.stop
//cancels any animation event stop: function(element,attribute){ if(element.skel_animate_ids[attribute]){ clearInterval(element.skel_animate_ids[attribute]); delete element.skel_animate_ids[attribute]; if(element.skel_old_display){ element.css('display',element.skel_old_display); } } },
and in SKEL.EFFECTS.Slide.step (line 575)
if(finished){ SKEL.EFFECTS.Slide.stop(element,cssAttribute); }
I think this needs to be done, but I cannot check it in my browser. If my code doesn’t work, I must have missed something, but I'm still sure that the problem is, you just need to figure out how to solve it (or change the libraries = D). You just try my suggestion, let me know how it works.
Greetings
EDIT: I could not wait, so I whipped up the JSFiddle for testing, and yes, it works with these changes. Check it out .
EDIT2: Corrected typo: still referencing skel_animate_id instead of skel_animate_ids in the first bit of code.