Nitesh Meshram
Nitesh Meshram

Reputation: 555

caricature - Image animation in iOS

caricature Image Animation

How to Implement this kind of animation in iOS objective c.

Currently I have implemented "CABasicAnimation" for this but still not able to achieve this very smoothly .

any suggestion ??

Thank you

Upvotes: 6

Views: 251

Answers (3)

Giuseppe Garassino
Giuseppe Garassino

Reputation: 2292

As Leena pointed out this is a simple loop of images.

Create your frames outside Xcode and then animate them this way:

NSArray *frames = [NSArray arrayWithObjects:[UIImage imageNamed:@"firstFrame.png"],
                       [UIImage imageNamed:@"secondFrame.png"],
                       // add other frames
                       , nil];
UIImageView *animatedImage = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
animatedImage.animationImages = frames;
animatedImage.animationDuration = 3.0f; // seconds
animatedImage.animationRepeatCount = 0; // 0 = loops forever
[animatedImage startAnimating];
[self.view addSubview:animatedImage];
[animatedImage release];

Upvotes: 0

Fogmeister
Fogmeister

Reputation: 77661

You'll need to use Core Image with a combination of different distortion filters.

You can then animate the intensity of the filters over time.

Upvotes: 1

Andrea
Andrea

Reputation: 26383

I don't think that with CABasic animation you can obtain that. Probably is a little "movie" made by combination of CIFilterd images (check CIFilter class in the doc). Another way around (but I'm writing as I'm thinking) is mask the image somehow with a CAShapeLayer and use CAAnimation on it.

Upvotes: 0

Related Questions