Featured iPhone Development Resources iOS Development Libraries Objective-C Open Source iOS Libraries And Tools

Library Providing Cocos2D CCAction Style Animation Sequences With UIKit Elements

A couple of months ago I mentioned a UIKit library allowing you to render tile maps and sprites like Cocos2D.

Here’s a library submitted by Nicholas Tau that provides Cocos2D style animations called UIKitAimationPro.

This means that you can easily create complex animation sequences with UIKit elements, also with nice blocks based callbacks.

As Nicholas states in the readme:

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

This source code example from the readme shows UIKitAnimationPro in action:

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
UIDisplaceAnimation * displace = [UIDisplaceAnimation actionByPoint:CGPointMake(200, 200)
UIFadeAnimation * fade = [UIFadeAnimation actionByAlpha:-0.5

UIRotateAnimation * rotate = [UIRotateAnimation actionByRotate:45

UIRotateAnimation * rotateTo = [UIRotateAnimation actionToRotate:15

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];

You can find UIKitAnimationPro on Github here.

An excellent library for UIKit animation.