Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
this.elem and this.options can be cached earlier
also try to reduce number of var declarations
  • Loading branch information
louisremi committed Jan 11, 2011
1 parent 885dda1 commit 1765b13
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/effects.js
Expand Up @@ -406,58 +406,61 @@ jQuery.fx.prototype = {

// Each step of an animation
step: function( gotoEnd ) {
var t = jQuery.now(), done = true;
var t = jQuery.now(),
done = true,
elem = this.elem,
options = this.options,
i, p;

if ( gotoEnd || t >= this.options.duration + this.startTime ) {
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();

this.options.curAnim[ this.prop ] = true;
options.curAnim[ this.prop ] = true;

for ( var i in this.options.curAnim ) {
if ( this.options.curAnim[i] !== true ) {
for ( i in options.curAnim ) {
if ( options.curAnim[i] !== true ) {
done = false;
}
}

if ( done ) {
// Reset the overflow
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
var elem = this.elem,
options = this.options;
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {

jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
} );
}

// Hide the element if the "hide" operation was done
if ( this.options.hide ) {
jQuery(this.elem).hide();
if ( options.hide ) {
jQuery(elem).hide();
}

// Reset the properties, if the item has been hidden or shown
if ( this.options.hide || this.options.show ) {
for ( var p in this.options.curAnim ) {
jQuery.style( this.elem, p, this.options.orig[p] );
if ( options.hide || options.show ) {
for ( p in options.curAnim ) {
jQuery.style( elem, p, options.orig[p] );
}
}

// Execute the complete function
this.options.complete.call( this.elem );
options.complete.call( elem );
}

return false;

} else {
var n = t - this.startTime;
this.state = n / this.options.duration;
var n = t - this.startTime,
specialEasing, defaultEasing;
this.state = n / options.duration;

// Perform the easing function, defaults to swing
var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop];
var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear");
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
specialEasing = options.specialEasing && options.specialEasing[this.prop],
defaultEasing = options.easing || (jQuery.easing.swing ? "swing" : "linear");
this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);

// Perform the next step of the animation
Expand Down

0 comments on commit 1765b13

Please sign in to comment.