fixes #27: bouncing accuracy circle on first location update
Showing
1 changed file
with
24 additions
and
0 deletions
@@ -3303,6 +3303,30 @@ | @@ -3303,6 +3303,30 @@ | ||
3303 | [self addAnnotation:_accuracyCircleAnnotation]; | 3303 | [self addAnnotation:_accuracyCircleAnnotation]; |
3304 | } | 3304 | } |
3305 | 3305 | ||
3306 | + if ( ! oldLocation) | ||
3307 | + { | ||
3308 | + // make accuracy circle bounce until we get our second update | ||
3309 | + // | ||
3310 | + [CATransaction begin]; | ||
3311 | + [CATransaction setAnimationDuration:0.75]; | ||
3312 | + [CATransaction setAnimationTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; | ||
3313 | + | ||
3314 | + CABasicAnimation *bounceAnimation = [CABasicAnimation animationWithKeyPath:@"transform"]; | ||
3315 | + bounceAnimation.repeatCount = MAXFLOAT; | ||
3316 | + bounceAnimation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2, 1.0)]; | ||
3317 | + bounceAnimation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.8, 0.8, 1.0)]; | ||
3318 | + bounceAnimation.removedOnCompletion = NO; | ||
3319 | + bounceAnimation.autoreverses = YES; | ||
3320 | + | ||
3321 | + [_accuracyCircleAnnotation.layer addAnimation:bounceAnimation forKey:@"animateScale"]; | ||
3322 | + | ||
3323 | + [CATransaction commit]; | ||
3324 | + } | ||
3325 | + else | ||
3326 | + { | ||
3327 | + [_accuracyCircleAnnotation.layer removeAnimationForKey:@"animateScale"]; | ||
3328 | + } | ||
3329 | + | ||
3306 | if ([newLocation distanceFromLocation:oldLocation]) | 3330 | if ([newLocation distanceFromLocation:oldLocation]) |
3307 | _accuracyCircleAnnotation.coordinate = newLocation.coordinate; | 3331 | _accuracyCircleAnnotation.coordinate = newLocation.coordinate; |
3308 | 3332 |
-
Please register or login to post a comment