Theocacao
Leopard
Design Element
Comment on "Core Animation Sample Code: NanoLife"
by Peter — Mar 05
If I click to attract the lifeforms to the cursor, let go, don't move the mouse and click again, they instantly jump to the mouse cursor without animating there

Scott, I'm curios as to why they animate towards the cursor when you click. From reading the code I would expect the behavior stated above.

Interestingly if I replace this line
CGPoint cgMousePointInView = NSPointToCGPoint(mousePointInView);
with
CGPoint cgMousePointInView = CGPointMake(0., 0.);

It always jumps immediately to the origin. Now, if you change the coordinates of the point to something like (10, 50) the first time it will animate to the point but any subsequent clicks will cause it to jump directly there.

How come it animates when you remove all animations and just set it's position?
Back to "Core Animation Sample Code: NanoLife"
Design Element

Copyright © Scott Stevenson 2004-2015