Xcode- iOS Animation RBBTweenAnimation

RBBTweenAnimation

RBBTweenAnimation allows you to animate from one value to another, similar to CABasicAnimation but with a greater flexibility in how the values should be interpolated.
It supports the same cubic Bezier interpolation that you get from CAMediaTimingFunction using the RBBCubicBezier helper function:

RBBTweenAnimation *easeInOutBack = [RBBTweenAnimation animationWithKeyPath:@"position.y"];

easeInOutBack.fromValue = @(-100.0f);
easeInOutBack.toValue = @(100.0f);
easeInOutBack.easing = RBBCubicBezier(0.68, -0.55, 0.265, 1.55);

easeInOutBack.additive = YES;
easeInOutBack.duration = 0.6;
However, RBBTweenAnimation also supports more complex easing functions such as RBBEasingFunctionEaseOutBounce:
RBBTweenAnimation *bounce = [RBBTweenAnimation animationWithKeyPath:@"position.y"];
bounce.fromValue = @(-100);
bounce.toValue = @(100);
bounce.easing = RBBEasingFunctionEaseOutBounce;

bounce.additive = YES;
bounce.duration = 0.8;
You can also specify your own easing functions, from scratch:

RBBTweenAnimation *sinus = [RBBTweenAnimation animationWithKeyPath:@"position.y"];
sinus.fromValue = @(0);
sinus.toValue = @(100);

sinus.easing = ^CGFloat (CGFloat fraction) {
    return sin((fraction) * 2 * M_PI);
};

sinus.additive = YES;
sinus.duration = 2;



Xcode- iOS Animation RBBTweenAnimation Xcode- iOS Animation RBBTweenAnimation Reviewed by Unknown on 2:15 PM Rating: 5

No comments:

Powered by Blogger.