Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1. <div id="angle" class="angle"></div>
  2. <div id="lastAngle" class="lastAngle"></div>
  3. <div id="angleRot" class="angleRot"></div>
  4. <div class="arrow"></div>
  5.  
  6. <script>
  7. /*
  8. * Easing Functions
  9. * only considering the t value for the range [0, 1] => [0, 1]
  10. */
  11. var EasingFunctions = {
  12. // no easing, no acceleration
  13. linear: function linear(t) {
  14. return t;
  15. },
  16. // accelerating from zero velocity
  17. easeInQuad: function easeInQuad(t) {
  18. return t * t;
  19. },
  20. // decelerating to zero velocity
  21. easeOutQuad: function easeOutQuad(t) {
  22. return t * (2 - t);
  23. },
  24. // acceleration until halfway, then deceleration
  25. easeInOutQuad: function easeInOutQuad(t) {
  26. return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
  27. },
  28. // accelerating from zero velocity
  29. easeInCubic: function easeInCubic(t) {
  30. return t * t * t;
  31. },
  32. // decelerating to zero velocity
  33. easeOutCubic: function easeOutCubic(t) {
  34. return --t * t * t + 1;
  35. },
  36. // acceleration until halfway, then deceleration
  37. easeInOutCubic: function easeInOutCubic(t) {
  38. return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
  39. },
  40. // accelerating from zero velocity
  41. easeInQuart: function easeInQuart(t) {
  42. return t * t * t * t;
  43. },
  44. // decelerating to zero velocity
  45. easeOutQuart: function easeOutQuart(t) {
  46. return 1 - --t * t * t * t;
  47. },
  48. // acceleration until halfway, then deceleration
  49. easeInOutQuart: function easeInOutQuart(t) {
  50. return t < .5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t;
  51. },
  52. // accelerating from zero velocity
  53. easeInQuint: function easeInQuint(t) {
  54. return t * t * t * t * t;
  55. },
  56. // decelerating to zero velocity
  57. easeOutQuint: function easeOutQuint(t) {
  58. return 1 + --t * t * t * t * t;
  59. },
  60. // acceleration until halfway, then deceleration
  61. easeInOutQuint: function easeInOutQuint(t) {
  62. return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t;
  63. },
  64. // elastic bounce effect at the beginning
  65. easeInElastic: function easeInElastic(t) {
  66. return (.04 - .04 / t) * Math.sin(25 * t) + 1;
  67. },
  68. // elastic bounce effect at the end
  69. easeOutElastic: function easeOutElastic(t) {
  70. return .04 * t / --t * Math.sin(25 * t);
  71. },
  72. // elastic bounce effect at the beginning and end
  73. easeInOutElastic: function easeInOutElastic(t) {
  74. return (t -= .5) < 0 ? (.01 + .01 / t) * Math.sin(50 * t) : (.02 - .01 / t) * Math.sin(50 * t) + 1;
  75. }
  76. };
  77. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement