How to replicate the Scale Up Animation when an app starts regularly (push app icon on HomeScreen) on an iPhone

后端 未结 2 480
走了就别回头了
走了就别回头了 2020-12-29 00:23

i want to replicate the animation when an app starts on iPhone. There is the first view scaling up from 50 % to 100% i think. later I want to use this as a transition betwee

2条回答
  •  我在风中等你
    2020-12-29 01:00

    You can do the same thing with CABasicAnimation and CAAnimationGroup, I actually thought that Core Animation over UIKit Animations was smoother and It gives you more control.

    CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
    animationGroup.removedOnCompletion = YES;
    
    CABasicAnimation *fadeAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"];
    fadeAnimation.fromValue = [NSNumber numberWithFloat:0.0];
    fadeAnimation.toValue = [NSNumber numberWithFloat:1.0];
    
    CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    scaleAnimation.fromValue = [NSNumber numberWithFloat:0.5];
    scaleAnimation.toValue = [NSNumber numberWithFloat:1.00];
    
    animationGroup.animations = [NSArray arrayWithObjects:fadeAnimation, scaleAnimation, nil];
    
    [self.layer addAnimation:animationGroup forKey:@"fadeAnimation"];
    self.layer.opacity = 1.0;
    

    "There's always more then one way to skin a cat"

提交回复
热议问题