Skip navigation.
 
mlMissing Core Animation Callbacks or Observing or whatever
FROM : Manfred Schwind
DATE : Wed Feb 27 18:16:25 2008

Core Animation is great. But I am missing something: I want to get 
called if something specific happens at the presentation layer. I want 
to get "informed" about the state of the animation.

An example:
When "flipping" a layer by rotating around the y axis, I want to know 
when the layer passes the 90 degrees angle.

One idea is to set up a timer exactly half the duration of the 
flipping animation and I'm done. It's a little "hacky" because of the 
different timer that may not exacly in sync with the animation timing, 
but let's say this is not so important for now. Problem here: 
depending on the timing function this might not work. It works with 
Linear and EaseInEaseOut, but not with EaseIn or EaseOut etc. (unless 
I do exactly know what functions are used for EaseIn or EaseOut.) But 
even if I know the time - what if the layer was already at some 
partially flipped state because another animation was still running 
and therefore the rotation just gets "re-targeted"? So I can not 
really tell at which time the layer passed the 90 degrees without 
having very specific knowledge about animating times, retargeting 
behaviour etc. ...

Another idea was to split the animation into two separate animations. 
One rotates from current to 90 degrees and the other from 90 to 180 
degrees. But here I have the same problem with re-tageting. It looks 
very ugly if "current" is not 0 degrees.

Then I had the idea to "observe" the rotation value via KVO somehow - 
but this also makes no sense of course, because I am at model layer. 
As far as I know I can not get hands on the presentation layer (I only 
get a copy of it at any time).

Is there any way to do something like that? Kind of observing animated 
value changes (observing values at presentation layer)?

Regards,
Mani
--
http://www.mani.de
iVolume - Loudness adjustment for iTunes.
LittleSecrets - The encrypted notepad.

Related mailsAuthorDate
No related mails found.