summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulie Lala <jules@okfoc.us>2014-12-18 23:19:28 -0500
committerJulie Lala <jules@okfoc.us>2014-12-18 23:19:28 -0500
commitdda251707cd91ec5d377816de4ea7a6e3da4147e (patch)
treebd94c63fbc04fa4d7d9b74b5d6751a827e6e9028
parentdddd544a566ce53a70351b9fc1391af5034ae09e (diff)
easing functions
-rw-r--r--css/sally.css5
-rw-r--r--js/util.js31
2 files changed, 30 insertions, 6 deletions
diff --git a/css/sally.css b/css/sally.css
index 61f544e..5d57693 100644
--- a/css/sally.css
+++ b/css/sally.css
@@ -60,8 +60,3 @@ body { transition: 0.1s linear; }
textarea { font-size:12pt; width: 45%; height: 300px; background: #333; color: #0f0; border: 0; font-family: 'FixedsysExcelsior301Regular'; outline: 0; border: 1px solid #333; background:#010;}
#import_rapper { display: none; }
#cursor_input { position: absolute; top: 0; right: 0; width:30px; opacity: 0; }
-
-
-@media screen and (-webkit-min-device-pixel-ratio:0) {
- #nvgovy{white-space:pre;}
-}
diff --git a/js/util.js b/js/util.js
index 27c5427..f76fc8e 100644
--- a/js/util.js
+++ b/js/util.js
@@ -113,4 +113,33 @@ function weave(a){
aa[0].forEach(function(el){ b.push(el) })
reverse(aa[1]).forEach(function(el){ b.push(el) })
return b
-} \ No newline at end of file
+}
+
+// easing functions
+function circular (t) { return Math.sqrt( 1 - ( --t * t ) ) }
+function quadratic (t) { return t * ( 2 - t ) }
+function back (t) {
+ var b = 4;
+ return ( t = t - 1 ) * t * ( ( b + 1 ) * t + b ) + 1;
+}
+function bounce (t) {
+ if (t >= 1) return 1;
+ if ( ( t /= 1 ) < ( 1 / 2.75 ) ) {
+ return 7.5625 * t * t;
+ } else if ( t < ( 2 / 2.75 ) ) {
+ return 7.5625 * ( t -= ( 1.5 / 2.75 ) ) * t + 0.75;
+ } else if ( t < ( 2.5 / 2.75 ) ) {
+ return 7.5625 * ( t -= ( 2.25 / 2.75 ) ) * t + 0.9375;
+ } else {
+ return 7.5625 * ( t -= ( 2.625 / 2.75 ) ) * t + 0.984375;
+ }
+}
+function elastic (t) {
+ var f = 0.22,
+ e = 0.4;
+
+ if ( t === 0 ) { return 0; }
+ if ( t == 1 ) { return 1; }
+
+ return ( e * Math.pow( 2, - 10 * t ) * Math.sin( ( t - f / 4 ) * ( 2 * Math.PI ) / f ) + 1 );
+}