Sunday, February 8, 2009

Animation...

Played with Core Animation today for about an hour or so. Managed to add a little bit. This addition gives the user feedback as whether there touch was successful. Very easy to do.


[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.40];
CGAffineTransform transform = CGAffineTransformMakeScale(1.5, 1.5);
bananaView.transform = transform;
bananaView.alpha = 0.0;
[UIView commitAnimations];


How it works. beginAnimations starts the animation block. you can guess what setAnimationDuration does. CGAffineTransformMakeScale basic sets the end product for how you want the View scaled, in this case 150% of original size. You then assign the transform to the View, and set the final alpha. Then finally commitAnimations. The overall effect is that in .4 seconds the View grows to 150% and fades to invisible.

Very interesting and very easy. Will play with it more.