]> git.wh0rd.org - tt-rss.git/blobdiff - lib/dojo/fx/easing.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dojo / fx / easing.js
diff --git a/lib/dojo/fx/easing.js b/lib/dojo/fx/easing.js
new file mode 100644 (file)
index 0000000..0de5d5e
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+       Copyright (c) 2004-2010, 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
+*/
+
+
+if(!dojo._hasResource["dojo.fx.easing"]){
+dojo._hasResource["dojo.fx.easing"]=true;
+dojo.provide("dojo.fx.easing");
+dojo.fx.easing={linear:function(n){
+return n;
+},quadIn:function(n){
+return Math.pow(n,2);
+},quadOut:function(n){
+return n*(n-2)*-1;
+},quadInOut:function(n){
+n=n*2;
+if(n<1){
+return Math.pow(n,2)/2;
+}
+return -1*((--n)*(n-2)-1)/2;
+},cubicIn:function(n){
+return Math.pow(n,3);
+},cubicOut:function(n){
+return Math.pow(n-1,3)+1;
+},cubicInOut:function(n){
+n=n*2;
+if(n<1){
+return Math.pow(n,3)/2;
+}
+n-=2;
+return (Math.pow(n,3)+2)/2;
+},quartIn:function(n){
+return Math.pow(n,4);
+},quartOut:function(n){
+return -1*(Math.pow(n-1,4)-1);
+},quartInOut:function(n){
+n=n*2;
+if(n<1){
+return Math.pow(n,4)/2;
+}
+n-=2;
+return -1/2*(Math.pow(n,4)-2);
+},quintIn:function(n){
+return Math.pow(n,5);
+},quintOut:function(n){
+return Math.pow(n-1,5)+1;
+},quintInOut:function(n){
+n=n*2;
+if(n<1){
+return Math.pow(n,5)/2;
+}
+n-=2;
+return (Math.pow(n,5)+2)/2;
+},sineIn:function(n){
+return -1*Math.cos(n*(Math.PI/2))+1;
+},sineOut:function(n){
+return Math.sin(n*(Math.PI/2));
+},sineInOut:function(n){
+return -1*(Math.cos(Math.PI*n)-1)/2;
+},expoIn:function(n){
+return (n==0)?0:Math.pow(2,10*(n-1));
+},expoOut:function(n){
+return (n==1)?1:(-1*Math.pow(2,-10*n)+1);
+},expoInOut:function(n){
+if(n==0){
+return 0;
+}
+if(n==1){
+return 1;
+}
+n=n*2;
+if(n<1){
+return Math.pow(2,10*(n-1))/2;
+}
+--n;
+return (-1*Math.pow(2,-10*n)+2)/2;
+},circIn:function(n){
+return -1*(Math.sqrt(1-Math.pow(n,2))-1);
+},circOut:function(n){
+n=n-1;
+return Math.sqrt(1-Math.pow(n,2));
+},circInOut:function(n){
+n=n*2;
+if(n<1){
+return -1/2*(Math.sqrt(1-Math.pow(n,2))-1);
+}
+n-=2;
+return 1/2*(Math.sqrt(1-Math.pow(n,2))+1);
+},backIn:function(n){
+var s=1.70158;
+return Math.pow(n,2)*((s+1)*n-s);
+},backOut:function(n){
+n=n-1;
+var s=1.70158;
+return Math.pow(n,2)*((s+1)*n+s)+1;
+},backInOut:function(n){
+var s=1.70158*1.525;
+n=n*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(n){
+if(n==0||n==1){
+return n;
+}
+var p=0.3;
+var s=p/4;
+n=n-1;
+return -1*Math.pow(2,10*n)*Math.sin((n-s)*(2*Math.PI)/p);
+},elasticOut:function(n){
+if(n==0||n==1){
+return n;
+}
+var p=0.3;
+var s=p/4;
+return Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/p)+1;
+},elasticInOut:function(n){
+if(n==0){
+return 0;
+}
+n=n*2;
+if(n==2){
+return 1;
+}
+var p=0.3*1.5;
+var s=p/4;
+if(n<1){
+n-=1;
+return -0.5*(Math.pow(2,10*n)*Math.sin((n-s)*(2*Math.PI)/p));
+}
+n-=1;
+return 0.5*(Math.pow(2,-10*n)*Math.sin((n-s)*(2*Math.PI)/p))+1;
+},bounceIn:function(n){
+return (1-dojo.fx.easing.bounceOut(1-n));
+},bounceOut:function(n){
+var s=7.5625;
+var p=2.75;
+var l;
+if(n<(1/p)){
+l=s*Math.pow(n,2);
+}else{
+if(n<(2/p)){
+n-=(1.5/p);
+l=s*Math.pow(n,2)+0.75;
+}else{
+if(n<(2.5/p)){
+n-=(2.25/p);
+l=s*Math.pow(n,2)+0.9375;
+}else{
+n-=(2.625/p);
+l=s*Math.pow(n,2)+0.984375;
+}
+}
+}
+return l;
+},bounceInOut:function(n){
+if(n<0.5){
+return dojo.fx.easing.bounceIn(n*2)/2;
+}
+return (dojo.fx.easing.bounceOut(n*2-1)/2)+0.5;
+}};
+}