Skip to content

Commit

Permalink
refs #7461 - update fx.easing inline docs and style adherance
Browse files Browse the repository at this point in the history
!strict



git-svn-id: http://svn.dojotoolkit.org/src/dojo/trunk@14999 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
phiggins42 committed Aug 28, 2008
1 parent 6de20dd commit e9e49c2
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions fx/easing.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,27 @@ dojo.fx.easing = {
},

quadOut: function(/* Decimal? */n){
return n * (n-2) * -1;
return n * (n - 2) * -1;
},

quadInOut: function(/* Decimal? */n){
n=n*2;
if(n<1){ return Math.pow(n, 2) / 2; }
return -1 * ((--n)*(n-2) - 1) / 2;
n = n * 2;
if(n < 1){ return Math.pow(n, 2) / 2; }
return -1 * ((--n) * (n - 2) - 1) / 2;
},

cubicIn: function(/* Decimal? */n){
return Math.pow(n, 3);
},

cubicOut: function(/* Decimal? */n){
return Math.pow(n-1, 3) + 1;
return Math.pow(n - 1, 3) + 1;
},

cubicInOut: function(/* Decimal? */n){
n=n*2;
if(n<1){ return Math.pow(n, 3) / 2; }
n-=2;
n = n * 2;
if(n < 1){ return Math.pow(n, 3) / 2; }
n -= 2;
return (Math.pow(n, 3) + 2) / 2;
},

Expand All @@ -64,49 +64,49 @@ dojo.fx.easing = {
},

quartOut: function(/* Decimal? */n){
return -1 * (Math.pow(n-1, 4) - 1);
return -1 * (Math.pow(n - 1, 4) - 1);
},

quartInOut: function(/* Decimal? */n){
n=n*2;
if(n<1){ return Math.pow(n, 4) / 2; }
n-=2;
return -1/2 * (Math.pow(n, 4) - 2);
n = n * 2;
if(n < 1){ return Math.pow(n, 4) / 2; }
n -= 2;
return -1 / 2 * (Math.pow(n, 4) - 2);
},

quintIn: function(/* Decimal? */n){
return Math.pow(n, 5);
},

quintOut: function(/* Decimal? */n){
return Math.pow(n-1, 5) + 1;
return Math.pow(n - 1, 5) + 1;
},

quintInOut: function(/* Decimal? */n){
n=n*2;
if(n<1){ return Math.pow(n, 5) / 2; };
n-=2;
n = n * 2;
if(n < 1){ return Math.pow(n, 5) / 2; };
n -= 2;
return (Math.pow(n, 5) + 2) / 2;
},

sineIn: function(/* Decimal? */n){
return -1 * Math.cos(n * (Math.PI/2)) + 1;
return -1 * Math.cos(n * (Math.PI / 2)) + 1;
},

sineOut: function(/* Decimal? */n){
return Math.sin(n * (Math.PI/2));
return Math.sin(n * (Math.PI / 2));
},

sineInOut: function(/* Decimal? */n){
return -1 * (Math.cos(Math.PI*n) - 1) / 2;
return -1 * (Math.cos(Math.PI * n) - 1) / 2;
},

expoIn: function(/* Decimal? */n){
return (n==0) ? 0 : Math.pow(2, 10 * (n - 1));
return (n == 0) ? 0 : Math.pow(2, 10 * (n - 1));
},

expoOut: function(/* Decimal? */n){
return (n==1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1);
return (n == 1) ? 1 : (-1 * Math.pow(2, -10 * n) + 1);
},

expoInOut: function(/* Decimal? */n){
Expand All @@ -123,7 +123,7 @@ dojo.fx.easing = {
},

circOut: function(/* Decimal? */n){
n = n-1;
n = n - 1;
return Math.sqrt(1 - Math.pow(n, 2));
},

Expand All @@ -135,27 +135,31 @@ dojo.fx.easing = {
},

backIn: function(/* Decimal? */n){
// summary: An easing function that starts away from the target, and
// quickly accelerates towards the end value
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
// summary: An easing function that pops past the range briefly, and
// slowly comes back.
n = n - 1;
var s = 1.70158;
return Math.pow(n, 2) * ((s + 1) * n + s) + 1;
},

backInOut: function(/* Decimal? */n){
// summary: An easing function combining the effects of backIn and backOut
var s = 1.70158 * 1.525;
n = n * 2;
if(n < 1){ return (Math.pow(n, 2)*((s+1)*n - s)) / 2; }
if(n < 1){ return (Math.pow(n, 2) * ((s + 1) * n - s)) / 2; }
n-=2;
return (Math.pow(n, 2) * ((s + 1) * n + s) + 2) / 2;
},

elasticIn: function(/* Decimal? */n){
// summary: An easing function the elastically snaps from the start value
if(n == 0 || n == 1){ return n; }
var p = .3;
var s = p / 4;
Expand Down

0 comments on commit e9e49c2

Please sign in to comment.