Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="angle" class="angle"></div>
- <div id="lastAngle" class="lastAngle"></div>
- <div id="angleRot" class="angleRot"></div>
- <div class="arrow"></div>
- <script>
- /*
- * Easing Functions
- * only considering the t value for the range [0, 1] => [0, 1]
- */
- var EasingFunctions = {
- // no easing, no acceleration
- linear: function linear(t) {
- return t;
- },
- // accelerating from zero velocity
- easeInQuad: function easeInQuad(t) {
- return t * t;
- },
- // decelerating to zero velocity
- easeOutQuad: function easeOutQuad(t) {
- return t * (2 - t);
- },
- // acceleration until halfway, then deceleration
- easeInOutQuad: function easeInOutQuad(t) {
- return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
- },
- // accelerating from zero velocity
- easeInCubic: function easeInCubic(t) {
- return t * t * t;
- },
- // decelerating to zero velocity
- easeOutCubic: function easeOutCubic(t) {
- return --t * t * t + 1;
- },
- // acceleration until halfway, then deceleration
- easeInOutCubic: function easeInOutCubic(t) {
- return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
- },
- // accelerating from zero velocity
- easeInQuart: function easeInQuart(t) {
- return t * t * t * t;
- },
- // decelerating to zero velocity
- easeOutQuart: function easeOutQuart(t) {
- return 1 - --t * t * t * t;
- },
- // acceleration until halfway, then deceleration
- easeInOutQuart: function easeInOutQuart(t) {
- return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
- },
- // accelerating from zero velocity
- easeInQuint: function easeInQuint(t) {
- return t * t * t * t * t;
- },
- // decelerating to zero velocity
- easeOutQuint: function easeOutQuint(t) {
- return 1 + --t * t * t * t * t;
- },
- // acceleration until halfway, then deceleration
- easeInOutQuint: function easeInOutQuint(t) {
- return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
- },
- // elastic bounce effect at the beginning
- easeInElastic: function easeInElastic(t) {
- return (.04 - .04 / t) * Math.sin(25 * t) + 1;
- },
- // elastic bounce effect at the end
- easeOutElastic: function easeOutElastic(t) {
- return .04 * t / --t * Math.sin(25 * t);
- },
- // elastic bounce effect at the beginning and end
- easeInOutElastic: function easeInOutElastic(t) {
- return (t -= .5) < 0 ? (.01 + .01 / t) * Math.sin(50 * t) : (.02 - .01 / t) * Math.sin(50 * t) + 1;
- }
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement