/*
- Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
dojo._hasResource["dojo.fx.easing"] = true;
dojo.provide("dojo.fx.easing");
+dojo.getObject("fx.easing", true, dojo);
+
dojo.fx.easing = {
- // summary:
- // Collection of easing functions to use beyond the default
+ // summary:
+ // Collection of easing functions to use beyond the default
// `dojo._defaultEasing` function.
- //
+ //
// description:
//
// Easing functions are used to manipulate the iteration through
// and the easing function progresses through that Line determing
// how quickly (or slowly) it should go. Or more accurately: modify
// the value of the _Line based on the percentage of animation completed.
- //
+ //
// All functions follow a simple naming convention of "ease type" + "when".
// If the name of the function ends in Out, the easing described appears
// towards the end of the animation. "In" means during the beginning,
// and InOut means both ranges of the Animation will applied, both
- // beginning and end.
+ // beginning and end.
//
- // One does not call the easing function directly, it must be passed to
+ // One does not call the easing function directly, it must be passed to
// the `easing` property of an animation.
//
// example:
// | dojo.require("dojo.fx.easing");
// | var anim = dojo.fadeOut({
- // | node: 'node',
+ // | node: 'node',
// | duration: 2000,
- // | // note there is no ()
+ // | // note there is no ()
// | easing: dojo.fx.easing.quadIn
// | }).play();
//
},
backIn: function(/* Decimal? */n){
- // summary:
- // An easing function that starts away from the target,
+ // summary:
+ // An easing function that starts away from the target,
// and quickly accelerates towards the end value.
- //
- // Use caution when the easing will cause values to become
+ //
+ // Use caution when the easing will cause values to become
// negative as some properties cannot be set to negative values.
var s = 1.70158;
return Math.pow(n, 2) * ((s + 1) * n - s);
},
backOut: function(/* Decimal? */n){
- // summary:
- // An easing function that pops past the range briefly, and slowly comes back.
+ // summary:
+ // An easing function that pops past the range briefly, and slowly comes back.
//
// description:
- // An easing function that pops past the range briefly, and slowly comes back.
+ // An easing function that pops past the range briefly, and slowly comes back.
//
- // Use caution when the easing will cause values to become negative as some
+ // Use caution when the easing will cause values to become negative as some
// properties cannot be set to negative values.
n = n - 1;
},
backInOut: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function combining the effects of `backIn` and `backOut`
//
// description:
// An easing function combining the effects of `backIn` and `backOut`.
- // Use caution when the easing will cause values to become negative
+ // Use caution when the easing will cause values to become negative
// as some properties cannot be set to negative values.
var s = 1.70158 * 1.525;
n = n * 2;
},
elasticIn: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function the elastically snaps from the start value
//
// description:
// An easing function the elastically snaps from the start value
- //
- // Use caution when the elasticity will cause values to become negative
+ //
+ // Use caution when the elasticity will cause values to become negative
// as some properties cannot be set to negative values.
if(n == 0 || n == 1){ return n; }
var p = .3;
},
elasticOut: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function that elasticly snaps around the target value,
// near the end of the Animation
//
// An easing function that elasticly snaps around the target value,
// near the end of the Animation
//
- // Use caution when the elasticity will cause values to become
+ // Use caution when the elasticity will cause values to become
// negative as some properties cannot be set to negative values.
if(n==0 || n == 1){ return n; }
var p = .3;
},
elasticInOut: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function that elasticly snaps around the value, near
// the beginning and end of the Animation.
//
// An easing function that elasticly snaps around the value, near
// the beginning and end of the Animation.
//
- // Use caution when the elasticity will cause values to become
+ // Use caution when the elasticity will cause values to become
// negative as some properties cannot be set to negative values.
if(n == 0) return 0;
n = n * 2;
},
bounceIn: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function that 'bounces' near the beginning of an Animation
return (1 - dojo.fx.easing.bounceOut(1 - n)); // Decimal
},
// An easing function that 'bounces' near the end of an Animation
var s = 7.5625;
var p = 2.75;
- var l;
+ var l;
if(n < (1 / p)){
l = s * Math.pow(n, 2);
}else if(n < (2 / p)){
},
bounceInOut: function(/* Decimal? */n){
- // summary:
+ // summary:
// An easing function that 'bounces' at the beginning and end of the Animation
if(n < 0.5){ return dojo.fx.easing.bounceIn(n * 2) / 2; }
return (dojo.fx.easing.bounceOut(n * 2 - 1) / 2) + 0.5; // Decimal