Last week I was fortunate to attend Facebook’s London Mobile Forum 2.0. This gathering of top London mobile developers and designers was a great chance to swap ideas and listen to a number of talks by Facebook, Big Nerd Ranch, Yammer, Bloom and Mozilla to name a few. The event was tiny with only 60 people in the room but it had many big players and it was great to talk to as many of them as possible, particularly at the free bar Facebook had laid on in the evening! So what mobile development secrets did we talk about? Continue reading
There are 2 posts filed in Core Animation (this is page 1 of 1).
Core Animation stops animation on app relaunch
On one of my projects I discovered a bug in a never-ending animation I had set up. Whenever the app was suspended (such as when you multitask and open another app), on relaunching the app the animation was frozen. After some investigating, I discovered that with Core Animation you need to set a flag on the CABasicAnimation class called removedOnCompletion to NO otherwise the animation will get cleaned up when it gets suspended.
CABasicAnimation *dartWiggleAnimation = [CABasicAnimation animationWithKeyPath:@"position"];
[NSValue valueWithCGPoint:CGPointMake(self.center.x-DART_WIGGLE_HALF, self.center.y+DART_CENTER_H_OFFSET)];
[NSValue valueWithCGPoint:CGPointMake(self.center.x+DART_WIGGLE_HALF, self.center.y+DART_CENTER_H_OFFSET)];
[CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseInEaseOut];
dartWiggleAnimation.duration = 0.4;
dartWiggleAnimation.repeatCount = HUGE_VALF;
dartWiggleAnimation.autoreverses = YES;
dartWiggleAnimation.removedOnCompletion = NO;
[[nextDart layer] addAnimation:dartWiggleAnimation forKey:@"dartWiggle"];
Does this seem like a bug or a feature?