- z.custom = function(f,t){
- if(z.timer) {return null;}
- this.now=f;z.a();z.io=z.cur();z.s=(new Date()).getTime();
- z.timer=setInterval(function(){z.step(f,t);}, 13);
+
+ // Remember the overflow of the element
+ z.oldOverflow = y.overflow;
+
+ // Make sure that nothing sneaks out
+ y.overflow = "hidden";
+
+ // Each step of an animation
+ z.step = function(firstNum, lastNum){
+ var t = (new Date()).getTime();
+
+ if (t > z.o.duration + z.startTime) {
+ // Stop the timer
+ clearInterval(z.timer);
+ z.timer = null;
+
+ // Reset the overflow
+ y.overflow = z.oldOverflow;
+
+ // If the element is, effectively, hidden - hide it
+ if( y.height == "0px" || y.width == "0px" ) {
+ y.display = "none";
+ }
+
+ // If the element was shown, and not using a custom number,
+ // set its height and width to auto
+ if ( ty != "opacity" && z.o.auto ) {
+ $.setAuto( z.el, 'height' );
+ $.setAuto( z.el, 'width' );
+ }
+
+ // If a callback was provided, execute it
+ if( z.o.onComplete.constructor == Function ) {
+ $.apply( z.el, z.onComplete );
+ }
+ } else {
+ // Figure out where in the animation we are and set the number
+ var p = (t - this.startTime) / z.o.duration;
+ z.now = ((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;
+
+ // Perform the next step of the animation
+ z.a();
+ }