Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define simpleEasing
- ///simpleEasing(Easing Function, Current Time, Beginning Value, Change In Value, Duration[, Ratio])
- __e = argument0; //Easing Function
- __t = argument1; //Current Time
- __b = argument2; //Beginning Value
- __c = argument3; //Change in Value
- __d = argument4; //Duration
- __s = 1.70158; //Ratio
- if (argument_count > 5){
- __s = argument[5];
- }
- if(script_exists(__e)){
- if(__t/__d < 1){
- return script_execute(__e);
- } else {
- return __b + __c;
- }
- }
- #define easeInSine
- return -__c * cos(__t/__d * (pi/2)) + __c + __b;
- #define easeOutSine
- return __c * sin(__t/__d * (pi/2)) + __b;
- #define easeInOutSine
- return -__c/2 * (cos(pi*__t/__d)-1)+__b;
- #define easeInQuad
- __t /= __d;
- return __c*(__t)*__t + __b;
- #define easeOutQuad
- __t /= __d;
- return -__c * (__t)*(__t - 2) + __b;
- #define easeInOutQuad
- __t /= __d/2;
- if(__t < 1) return __c/2*__t*__t + __b;
- return -__c/2 * ((--__t)*(__t-2) - 1) + __b;
- #define easeInCubic
- __t /= __d;
- return __c * power(__t,3) + __b;
- #define easeOutCubic
- __t /= __d - 1;
- return __c * (power(__t,3) + 1) + __b;
- #define easeInOutCubic
- __t /= __d/2;
- if(__t < 1){
- return __c/2*power(__t,3) + __b;
- } else {
- __t -= 2;
- return __c / 2 * (power(__t,3) + 2) + __b;
- }
- #define easeInQuart
- __t /= __d;
- return __c * power(__t,4) + __b;
- #define easeOutQuart
- __t = __t/__d-1;
- return -__c * (power(__t,4) - 1) + __b;
- #define easeInOutQuart
- __t /= __d/2;
- if(__t < 1){
- return __c/2*power(__t,4)+__b;
- } else {
- __t -= 2;
- return -__c/2 * (power(__t,4) - 2) + __b;
- }
- #define easeInQuint
- __t /= __d;
- return __c * power(__t,5) + __b;
- #define easeOutQuint
- __t = __t/__d-1;
- return __c * (power(__t,5) + 1) + __b;
- #define easeInOutQuint
- __t /= __d/2;
- if(__t < 1){
- return __c/2*power(__t,5)+__b;
- } else {
- __t -= 2;
- return __c/2 * (power(__t,5) + 2) + __b;
- }
- #define easeInExpo
- if(__t == 0) return __b;
- else return __c * power(2, 10 * (__t/__d - 1)) + __b;
- #define easeOutExpo
- return __c * (-power(2, -10 * __t/__d) + 1) + __b;
- #define easeInOutExpo
- if(__t == 0) return __b;
- __t /= __d/2;
- if(__t < 1) return __c/2 * power(2, 10 * (__t -1)) + __b;
- else return __c/2 * (-power(2, -10 * --__t) + 2) + __b;
- #define easeInCirc
- __t /= __d;
- return -__c * (sqrt(1 - __t * __t) - 1) + __b;
- #define easeOutCirc
- __t = __t/__d-1;
- return __c * sqrt(1 - __t*__t) + __b;
- #define easeInOutCirc
- __t /= __d/2;
- if(__t < 1) {
- return -__c/2 * (sqrt(1 - __t * __t) - 1) + __b;
- } else {
- __t -= 2;
- return __c/2 * (sqrt(1 - __t * __t) + 1) + __b;
- }
- #define easeInBack
- __t /= __d;
- return __c * __t * __t * ((__s+1)*__t - __s) + __b;
- #define easeOutBack
- __t = __t/__d-1;
- return __c * (__t * __t * ((__s+1)*__t + __s) + 1) + __b;
- #define easeInOutBack
- __t /= __d / 2;
- __s*=1.525
- if(__t < 1){
- return __c/2*(__t*__t*((__s + 1)*__t-__s)) + __b;
- } else {
- __t -= 2;
- __s *= 1.525;
- return __c/2 * (__t*__t*((__s+1)*__t+__s) + 2) + __b;
- }
- #define easeInElastic
- __s = 1.70158;
- __p = 0;
- __a = __c;
- if(__t == 0) return __b;
- __t /= __d;
- if(!__p) __p = __d * 0.3;
- if(__a < abs(__c))
- {
- __a = __c;
- __s = __p / 4;
- }
- else __s = __p / (2 * pi) * arcsin(__c / __a);
- return -(__a * power(2, 10 * (--__t)) * sin((__t * __d - __s) * (2 * pi) / __p)) + __b;
- #define easeOutElastic
- __s = 1.70158;
- __p = 0;
- __a = __c;
- if(__t == 0) return __b;
- __t /= __d;
- if(!__p) __p = __d * 0.3;
- if(__a < abs(__c))
- {
- __a = __c;
- __s = __p / 4;
- }
- else __s = __p / (2 * pi) * arcsin(__c / __a);
- return __a * power(2, -10 * __t) * sin((__t * __d - __s) * (2 * pi) / __p) + __c + __b;
- #define easeInOutElastic
- __s = 1.70158;
- __p = 0;
- __a = __c;
- if(__t == 0) return __b;
- __t /= __d/2;
- if(__t == 2) return __b + __c;
- if(!__p) __p = __d * (0.3*1.5);
- if(__a < abs(__c))
- {
- __a = __c;
- __s = __p / 4;
- }
- else __s = __p / (2 * pi) * arcsin(__c / __a);
- if(__t<1){
- return -0.5*(__a * power(2, 10 * (--__t)) * sin((__t * __d - __s) * (2 * pi) / __p)) + __b;
- } else {
- return __a * power(2, -10 * (--__t)) * sin((__t * __d - __s) * (2 * pi) / __p)*0.5 + __c + __b;
- }
- #define easeInBounce
- __t = __d - __t;
- temp__b = __b;
- __b = 0;
- __t /= __d;
- if(__t < (1/2.75)){
- return __c - __c*(7.5625*__t*__t) + __b + temp__b;
- } else if (__t < (2/2.75)) {
- __t -= (1.5/2.75);
- return __c - __c*(7.5625*__t*__t + 0.75) + __b + temp__b;
- } else if (__t < (2.5/2.75)) {
- __t -= (2.25/2.75);
- return __c - __c*(7.5625*__t*__t + 0.9375) + __b + temp__b;
- } else {
- __t -= (2.625/2.75);
- return __c - __c*(7.5625*__t*__t + 0.984375) + __b + temp__b;
- }
- #define easeOutBounce
- __t /= __d;
- if(__t < (1/2.75)){
- return __c*(7.5625*__t*__t) + __b;
- } else if (__t < (2/2.75)) {
- __t -= (1.5/2.75);
- return __c*(7.5625*__t*__t + 0.75) + __b;
- } else if (__t < (2.5/2.75)) {
- __t -= (2.25/2.75);
- return __c*(7.5625*__t*__t + 0.9375) + __b;
- } else {
- __t -= (2.625/2.75);
- return __c*(7.5625*__t*__t + 0.984375) + __b;
- }
- #define easeInOutBounce
- if(__t < __d/2){
- __t *= 2;
- __t = __d - __t;
- temp__b = __b;
- __b = 0;
- __t /= __d;
- if(__t < (1/2.75)){
- return (__c - __c*(7.5625*__t*__t) + __b) * 0.5 + temp__b;
- } else if (__t < (2/2.75)) {
- __t -= (1.5/2.75);
- return (__c - __c*(7.5625*__t*__t + 0.75) + __b) * 0.5 + temp__b;
- } else if (__t < (2.5/2.75)) {
- __t -= (2.25/2.75);
- return (__c - __c*(7.5625*__t*__t + 0.9375) + __b) * 0.5 + temp__b;
- } else {
- __t -= (2.625/2.75);
- return (__c - __c*(7.5625*__t*__t + 0.984375) + __b) * 0.5 + temp__b;
- }
- } else {
- __t = __t*2-__d;
- temp__b = __b;
- __b = 0;
- __t /= __d;
- if(__t < (1/2.75)){
- return (__c*(7.5625*__t*__t) + __b) * 0.5 + __c * 0.5 + temp__b;
- } else if (__t < (2/2.75)) {
- __t -= (1.5/2.75);
- return (__c*(7.5625*__t*__t + 0.75) + __b) * 0.5 + __c * 0.5 + temp__b;
- } else if (__t < (2.5/2.75)) {
- __t -= (2.25/2.75);
- return (__c*(7.5625*__t*__t + 0.9375) + __b) * 0.5 + __c * 0.5 + temp__b;
- } else {
- __t -= (2.625/2.75);
- return (__c*(7.5625*__t*__t + 0.984375) + __b) * 0.5 + __c * 0.5 + temp__b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment