Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Alternatively, if you're making a MKAnnotationView subclass, you can use <code>didMoveToSuperview</code> to trigger the animation. The following does a drop that ends in a slight 'squish' effect</p> <pre><code> #define kDropCompressAmount 0.1 @implementation MyAnnotationViewSubclass ... - (void)didMoveToSuperview { CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"]; animation.duration = 0.4; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeTranslation(0, -400, 0)]; animation.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; CABasicAnimation *animation2 = [CABasicAnimation animationWithKeyPath:@"transform"]; animation2.duration = 0.10; animation2.beginTime = animation.duration; animation2.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; animation2.toValue = [NSValue valueWithCATransform3D:CATransform3DScale(CATransform3DMakeTranslation(0, self.layer.frame.size.height*kDropCompressAmount, 0), 1.0, 1.0-kDropCompressAmount, 1.0)]; animation2.fillMode = kCAFillModeForwards; CABasicAnimation *animation3 = [CABasicAnimation animationWithKeyPath:@"transform"]; animation3.duration = 0.15; animation3.beginTime = animation.duration+animation2.duration; animation3.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; animation3.toValue = [NSValue valueWithCATransform3D:CATransform3DIdentity]; animation3.fillMode = kCAFillModeForwards; CAAnimationGroup *group = [CAAnimationGroup animation]; group.animations = [NSArray arrayWithObjects:animation, animation2, animation3, nil]; group.duration = animation.duration+animation2.duration+animation3.duration; group.fillMode = kCAFillModeForwards; [self.layer addAnimation:group forKey:nil]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload