diff options
Diffstat (limited to 'ui/effects/effect-bounce.js')
-rw-r--r-- | ui/effects/effect-bounce.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/effects/effect-bounce.js b/ui/effects/effect-bounce.js index 06bc84426..1743ef503 100644 --- a/ui/effects/effect-bounce.js +++ b/ui/effects/effect-bounce.js @@ -33,7 +33,7 @@ return $.effects.define( "bounce", function( options, done ) { var upAnim, downAnim, refValue, element = $( this ), - // defaults: + // Defaults: mode = options.mode, hide = mode === "hide", show = mode === "show", @@ -41,12 +41,12 @@ return $.effects.define( "bounce", function( options, done ) { distance = options.distance, times = options.times || 5, - // number of internal animations + // Number of internal animations anims = times * 2 + ( show || hide ? 1 : 0 ), speed = options.duration / anims, easing = options.easing, - // utility: + // Utility: ref = ( direction === "up" || direction === "down" ) ? "top" : "left", motion = ( direction === "up" || direction === "left" ), i = 0, @@ -57,7 +57,7 @@ return $.effects.define( "bounce", function( options, done ) { refValue = element.css( ref ); - // default distance for the BIGGEST bounce is the outer Distance / 3 + // Default distance for the BIGGEST bounce is the outer Distance / 3 if ( !distance ) { distance = element[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3; } @@ -66,7 +66,7 @@ return $.effects.define( "bounce", function( options, done ) { downAnim = { opacity: 1 }; downAnim[ ref ] = refValue; - // if we are showing, force opacity 0 and set the initial position + // If we are showing, force opacity 0 and set the initial position // then do the "first" animation element .css( "opacity", 0 ) @@ -74,13 +74,14 @@ return $.effects.define( "bounce", function( options, done ) { .animate( downAnim, speed, easing ); } - // start at the smallest distance if we are hiding + // Start at the smallest distance if we are hiding if ( hide ) { distance = distance / Math.pow( 2, times - 1 ); } downAnim = {}; downAnim[ ref ] = refValue; + // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here for ( ; i < times; i++ ) { upAnim = {}; |