CALayer--动画组

-(void)touchesBegan:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event{
    

    
    CAAnimationGroup *group = [CAAnimationGroup animation];
    
    //缩放
    CABasicAnimation *scaleAnim = [CABasicAnimation animation];
    //设置属性
    scaleAnim.keyPath = @"transform.scale";
    scaleAnim.toValue = @0.5;

    
    //平移
    CABasicAnimation *Anim = [CABasicAnimation animation];
    //设置属性
    Anim.keyPath = @"position.y";
    Anim.toValue = @(400);
    group.animations = @[scaleAnim,Anim];
    
    
    group.removedOnCompletion = NO;
    group.fillMode  = kCAFillModeForwards;
    //添加动画
    [self.redView.layer addAnimation:group forKey:nil];
    
}

你可能感兴趣的:(CALayer--动画组)