Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.15 KB

渐变动画.md

File metadata and controls

30 lines (25 loc) · 1.15 KB

[^Debug 模拟器工具栏Slow Animations可以降低动画速度观察动画效果]

  /*
     UIViewAnimationOptionCurveEaseInOut  动画开始/结束比较缓慢,中间相对较快
     UIViewAnimationOptionCurveEaseIn     动画开始比较缓慢
     UIViewAnimationOptionCurveEaseOut    动画结束比较缓慢
     UIViewAnimationOptionCurveLinear     线性---> 匀速
     */
    [UIView animateWithDuration:1.0 delay:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        
        CGRect frame = self.animationView.frame;
        frame.origin.y += 50;
        self.animationView.frame = frame;
        
    } completion:^(BOOL finished) {
        self.animationView.backgroundColor = [UIColor greenColor];
    }];
 //上部的图片复位
        //usingSpringWithDamping:弹性系数.越小弹性越大,类似于线程且优于dispatch_after
        [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.3 initialSpringVelocity:0 options: UIViewAnimationOptionCurveLinear  animations:^{
            
            self.topImageV.layer.transform = CATransform3DIdentity;
            
        } completion:nil];
    }