UIView的动画

UIView动画的第一种

 //  1.动画
    // 参数一:动画的播放时长
    // 参数二:把要实现的动画效果,放到block里去完成
//    [UIView animateWithDuration:2 animations:^{
//        self.myView.frame = CGRectMake(100, 100, 150, 150);
        self.myView.backgroundColor = [UIColor cyanColor];
        self.myView.alpha = 0;
//    }];

第二种

//    [UIView animateWithDuration:2 animations:^{
//        self.myView.frame = CGRectMake(100, 100, 150, 100);
//    } completion:^(BOOL finished) {
//        self.myView.backgroundColor = [UIColor cyanColor];
//       [UIView animateWithDuration:2 animations:^{
//           self.myView.frame = CGRectMake(100, 100, 150, 0);
//       }];
//    }];

第三种

 // UIView的第三种动画
    // 参数二:延时多久执行
//    [UIView animateWithDuration:2 delay:0.1 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionAutoreverse animations:^{
//        self.myView.frame = CGRectMake(100, 100, 150, 200);
//    } completion:^(BOOL finished) {
//            [UIView animateWithDuration:2 animations:^{
//               self.myView.frame = CGRectMake(100, 100, 150, 0);
//            }];
//    
//    }];

第四种

 // UIView的第四种动画
    // 下弹
    // 参数3:震动的幅度,越小越大
    // 参数4:初始速度,越快越大
    [UIView animateWithDuration:2 delay:0.1 usingSpringWithDamping:0.1 initialSpringVelocity:10 options:UIViewAnimationOptionRepeat animations:^{
         self.myView.frame = CGRectMake(100, 100, 150, 150);
    } completion:^(BOOL finished) {
        
    }];


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值