Re: best way of making a constant animation
Re: best way of making a constant animation
- Subject: Re: best way of making a constant animation
- From: Gerry Beggs <email@hidden>
- Date: Thu, 20 Jan 2011 18:01:07 -0600
Hello Gustavo.
This sounds like a perfect job for Core Animation.
With Core Animation, you can apply the animation to the UIImageView's layer.
Core Animation allows for animations to run once and stop automatically, repeat a specific number of times, or repeat indefinitely until you tell it to stop.
I do something very similar in one of my projects. Here is how you set up the rotation animation (do this to each of your 4 views that you want to rotate):
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotationAnimation.duration = 1.0;
rotationAnimation.fromValue = [NSNumber numberWithFloat:0.0];
rotationAnimation.toValue = [NSNumber numberWithFloat:2.0*M_PI];
rotationAnimation.repeatCount = HUGE_VALF;
[flashImageView.layer addAnimation:rotationAnimation forKey:@"RotatingFlash"];
When you want the animation to stop do this:
[flashImageView.layer removeAnimationForKey:@"RotatingFlash"];
On 2011-01-20, at 3:57 PM, Gustavo Pizano wrote:
> Hello all, sorry to bother with such a question... here it goes.
>
> I need to have a rotate animation of a UIImageView, very very soft, I know using UIView class methods I can make the animation and setting the affine transform + plus the duration to something really big like 1e100f, the thing is.. that I need that same animation to happen at the same on another 3 UIImageView which are in the other 3 corners of the display.. What would be the best approach here?.
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
email@hidden http://www.GerrysCuppaTea.org/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden