二〇一六年十一月一日
Equations for Easing Functions
Here is a list of easing functions used in GMotions in BotanAS
t: time
d: duration
returns 0 <= v <= 1
t: time
d: duration
returns 0 <= v <= 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | getEaseValue( float t, float d ) if ( d == 0 ) return 1; if ( t == 0 ) return 0; if ( t == d ) return 1; float s = 1.70158; // Back return ( t /= d ) * t * ( ( s + 1 ) * t - s ); // OutBack return ( ( t = t / d - 1 ) * t * ( ( s + 1 ) * t + s ) + 1 ); // InOutBack if ( ( t /= d / 2 ) < 1 ) return .5 * ( t * t * ( ( ( s * = ( 1.525 ) ) + 1 ) * t - s ) ); else return .5 * ( ( t -= 2 ) * t * ( ( ( s * = ( 1.525 ) ) + 1 ) * t + s ) + 2 ); // Bounce return 1 - getEaseValue( 4, d - t, d ); // O if ( ( t/=d ) < ( 1/2.75 ) ) return ( 7.5625 * t * t ); else if ( t < ( 2/2.75 ) ) return ( 7.5625 * ( t-=( 1.5/2.75 ) ) * t + .75 ); else if ( t < ( 2.5/2.75 ) ) return ( 7.5625 * ( t-=( 2.25/2.75 ) ) * t + .9375 ); else return ( 7.5625 * ( t-=( 2.625/2.75 ) ) * t + .984375 ); // M if ( t < d / 2 ) return getEaseValue( 3, t * 2, d ) * 0.5; else return getEaseValue( 4, t * 2 - d, d ) * 0.5 + 0.5; // checkInnerControlular return - ( Math.sqrt( 1 - ( t /= d ) * t ) - 1 ); // O return Math.sqrt( 1 - ( t = t / d - 1 ) * t ); // M if ( ( t /= d / 2 ) < 1 ) return - .5 * ( Math.sqrt( 1 - t * t ) - 1 ); else return .5 * ( Math.sqrt( 1 - ( t -= 2 ) * t ) + 1 ); // Cubic return ( t /= d ) * t * t; // O return ( ( t = t / d - 1 ) * t * t + 1 ); // M if ( ( t /= d / 2 ) < 1 ) return .5 * t * t * t; else return .5 * ( ( t -= 2 ) * t * t + 2 ); // Elastic t /= d; var p:Number = d * 0.3; s = p / 4; return - Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ); // O p = d * 0.3; s = p / 4; return Math.pow( 2, - 10 * ( t / d ) ) * Math.sin( ( t - s ) * ( 2 * Math.PI ) / p ) + 1; // M t /= d / 2; p = d * ( 0.3 * 1.5 ); s = p / 4; if ( t < 1 ) return - 0.5 * ( Math.pow( 2, 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) ); else return Math.pow( 2, - 10 * ( t -= 1 ) ) * Math.sin( ( t * d - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1; // Exponential return t == 0 ? 0 : Math.pow( 2, 10 * ( t / d - 1 ) ); // O return t == d ? 1 : ( - Math.pow( 2, - 10 * t / d ) + 1 ); // M if ( ( t /= d / 2 ) < 1 ) return .5 * Math.pow( 2, 10 * ( t - 1 ) ); else return .5 * ( - Math.pow( 2, - 10 * --t ) + 2 ); // Linear, None return t / d; // Regular, Quardurationatic return ( t /= d ) * t; // O return - ( t /= d ) * ( t - 2 ); // M if ( ( t /= d / 2 ) < 1 ) return .5 * t * t; else return - .5 * ( ( --t ) * ( t - 2 ) - 1 ); // Quartic return ( t /= d ) * t * t * t; // O return - ( ( t = t / d - 1 ) * t * t * t - 1 ); // M if ( ( t /= d / 2 ) < 1 ) return .5 * t * t * t * t; else return - .5 * ( ( t -= 2 ) * t * t * t - 2 ); // Strong, Quintic return ( t /= d ) * t * t * t * t; // O return ( ( t = t / d - 1 ) * t * t * t * t + 1 ); // M if ( ( t /= d / 2 ) < 1 ) return .5 * t * t * t * t * t; else return .5 * ( ( t -= 2 ) * t * t * t * t + 2 ); // Sine return - Math.cos( t / d * ( Math.PI / 2 ) ) + 1; // O return Math.sin( t / d * ( Math.PI / 2 ) ); // M return - .5 * ( Math.cos( Math.PI * t / d ) - 1 ); |

Tue Nov 01 2016 02:35:42 GMT+0000 (Coordinated Universal Time)
Last modified: Wed Nov 09 2016 02:38:32 GMT+0000 (Coordinated Universal Time)
Comments
No comments here.
Do you even comment?
website:
Not a valid website
Invalid email format
Please enter your email
*Name:
Please enter a name
Submit
抱歉,Google Recaptcha 服務被牆掉了,所以不能回覆了