Re: Change duration of a running CAAnimation?
Re: Change duration of a running CAAnimation?
- Subject: Re: Change duration of a running CAAnimation?
- From: Oleg Krupnov <email@hidden>
- Date: Fri, 26 Nov 2010 19:07:50 +0200
Thanks Matt! I have already found another solution that worked pretty
well: Instead of using the repeatCount property, I set a delegate on
the animation and add another animation manually each time the
previous one ends (animationDidEnd: finished:). In this way I can
fully control the fromValue and toValues of each loop of the
animation.
On Fri, Nov 26, 2010 at 6:51 PM, Matt Neuburg <email@hidden> wrote:
> On Thu, 25 Nov 2010 20:40:57 +0200, Oleg Krupnov <email@hidden> said:
>>Is there a way to change the duration of an already running
>>CAAnimation, in order to change its speed?
>>
>>The animation is added explicitly via [layer addAnimation: forKey:]
>>
>>When I try to get the animation with [layer animationForKey:] and call
>>[animation setDuration:], I get an exception that I'm trying to modify
>>a readonly animation.
>>
>>I know I could cancel the current animation and start a new one using
>>the current [layer presentationLayer]'s value as the fromValue, but
>>this is not convenient because my animation is repetitive and after
>>such a manipulation it will start from a wrong fromValue on the next
>>loop.
>
> Nevertheless that's what you're probably going to have to do. The +timeOffset+ property may assist you here in starting the new animation "in the middle"; also, observe that +repeatCount+ is a float (it does not have to indicate an integral number of repetitions). m.
>
> --
> matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings
_______________________________________________
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