开发者

CATransition as an explicit animation

开发者 https://www.devze.com 2023-02-25 06:36 出处:网络
Greetings to all. Does anyone know if it is possible to essentially convert CATransition to an explicit animation? That is, I almost want it to behave like CABasicAnimation does- I need to be able to

Greetings to all.

Does anyone know if it is possible to essentially convert CATransition to an explicit animation? That is, I almost want it to behave like CABasicAnimation does- I need to be able to create the CATransition object, set the options for it (duration, timingFunction, delegate, type, fillMode, removedOnCompletion, etc)- then essentially store it for later use and make sure it isn't trying to animate stuff that's happening between the CATransition object creation and the point in time at which I actually need it to animate a set of properties.

If I'm using CABasicAnimation, I can easily do this as nothing is animated until the animation is added to the layer and only the property specified in animationWithKeyPath is animated between toValue/fromValue. However, CATransition apparently fires [CATransaction begin] the moment you create the animation object for capturing property changes.

What I need to be able to do (as per above) is create the CATransition object, set the above options, then put it away until I actually need to use it- at which point I'll change the actual properties that it needs to animate, then add it to the appropriate CALayer via addAnimation.

Does anyone know how to do this safely?

PS: The reason for this is because my application depends heavily on a custom animation queueing system that handles animation dependencies. For example, certain things need to animate before an orientation change occurs, so I can queue ~10 animations which will all fire off AND the orientation change animation object as well- but the orientation change animation won't fire until the previous animations that it depends on have finished. Incidentally, CABasicAnimation can be wrapped up nicely into a queued animation object class. CATransition seems to be a bit of a different beast, hence the above question- I need to be able to safely create an animation queue object, setup a bunch of CATransition options, queue it up, then actually have it execute later on (meanwhile all sorts of stuff is happening) when all of it's depen开发者_如何学JAVAdencies have been satisfied (in this case, CATransition is being used for the orientation change animation).

Thanks, -Keven Tipping

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号