Theocacao
Leopard
Design Element
Comment on "Core Animation Sample Code: NanoLife"
by Scott Stevenson — Mar 05
@Peter: How come it animates when you remove all animations and just set it's position?

In this case, "remove animations" means "stop all animations which are currently in progress". When you set the "position" on the layer, you're changing the value of an animatable property which can trigger a new animation.

I haven't looked at the code to see why clicking in the same place twice only causes an animation the first time, but I suspect it's because the "random movement" animation is explicitly added -- it's not the result of animating a "position" property change. In other words, the layer may still consider itself to be at the location of the original mouse click, so it sees no reason to animate.

This is just a guess, though. I'd have to go back and look. Notably, Nano Spores does not have this issue.
Back to "Core Animation Sample Code: NanoLife"
Design Element

Copyright © Scott Stevenson 2004-2015