Skip to content

You can create animation in UIKit just like cocos2d's CCAction (also API in Sprite Kit without iOS7). It's really easy if you'll play a animation sequence.

Notifications You must be signed in to change notification settings

demonnico/UIKitAnimationPro

Repository files navigation

Why Use It

  • It helps you create a sequnce of animaions like the way in cocos2d. (also like Sprite Kit even without iOS7)

How To Use

UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
[self.view addSubview:view];
view.backgroundColor = [UIColor redColor];
[view release];

UICallbackBlock * callback = [UICallbackBlock actionWithBlock:^(id data)
{
    NSLog(@"animation finish");
}];

UIScaleAnimation * scale = [UIScaleAnimation actionByScaleX:2.0
                                                     ScaleY:3.0
                                                   Duration:1];
UIDisplaceAnimation * displace = [UIDisplaceAnimation actionByPoint:CGPointMake(200, 200)
                                                           Duration:1.0];
UIFadeAnimation * fade = [UIFadeAnimation actionByAlpha:-0.5
                                               Duration:1.0];

UIRotateAnimation * rotate = [UIRotateAnimation actionByRotate:45
                                                      Duration:1.0];

UIRotateAnimation * rotateTo = [UIRotateAnimation actionToRotate:15
                                                      Duration:1.0];

UIAnimationSequence * seq = [[UIAnimationSequence alloc] init];
[seq addAction:scale];
[seq addAction:callback];
[seq addAction:displace];
[seq addAction:fade];
[seq addAction:rotate];
[seq addAction:rotateTo];
[seq addAction:callback];

//of course,if you just only one animation, you just need
//[view runAction:scale] or [view runAction:displace];
[view runAction:seq];

Creator

Nicholas Tau

License

UIKitAnimation is available under the MIT license. See the LICENSE file for more info.

Bitdeli Badge

About

You can create animation in UIKit just like cocos2d's CCAction (also API in Sprite Kit without iOS7). It's really easy if you'll play a animation sequence.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published