Created
May 17, 2017 20:02
-
-
Save jamesmusgrave/8c9f016b3d840071bb8984a3d4323157 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( settings.easing === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity | |
if ( settings.easing === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity | |
if ( settings.easing === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration | |
if ( settings.easing === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity | |
if ( settings.easing === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity | |
if ( settings.easing === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration | |
if ( settings.easing === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity | |
if ( settings.easing === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity | |
if ( settings.easing === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration | |
if ( settings.easing === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity | |
if ( settings.easing === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity | |
if ( settings.easing === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment