Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (double)reversibleEaseInOut:(double)t b:(double)b c:(double)c d:(double)d {
- // The alotted time has passed, stop doing weird maths:
- if (t>d) return c;
- // Going the "wrong" direction, needs to be fixed
- BOOL reverse = NO;
- if (c < b) {
- reverse = YES;
- double newc = b;
- b = c;
- c = newc;
- }
- double result = [self easeInOut:t b:b c:c d:d];
- if (reverse) result = c - result;
- return result;
- }
- // Source: http://gizma.com/easing/#quad3
- - (double)easeInOut:(double)t b:(double)b c:(double)c d:(double)d {
- t /= d/2;
- if (t < 1) return c/2*t*t + b;
- t--;
- return -c/2 * (t*(t-2) - 1) + b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement