首页 > 其他 > 详细

2016.01.22 简单动画

时间:2016-01-25 20:57:05      阅读:136      评论:0      收藏:0      [点我收藏+]

简单动画没什么好说的,直接看代码。=-=

//横向、纵向移动
    [UIView animateWithDuration:0.5 animations:^{
        self.aView.frame = CGRectMake(_aView.frame.origin.x, _aView.frame.origin.y + 50, _aView.frame.size.width, _aView.frame.size.height);
    }];
    
    //渐变效果
    [UIView animateWithDuration:0.5 animations:^{
        _aView.alpha = !_aView.alpha;
    }];
    
    //翻页效果
    [UIView beginAnimations:nil context:nil];//开始动画的配置
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseIn];//动画的『节奏』
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:_aView cache:NO];
    [UIView commitAnimations];//动画配置完毕,提交动画
    
    //旋转
    [UIView animateWithDuration:0.5 animations:^{
        //只能做一次
//        _aView.transform = CGAffineTransformMakeRotation(M_PI);
        //能多次
        _aView.transform = CGAffineTransformRotate(_aView.transform, M_PI_4);
    }];
    
    //放大效果
    [UIView animateWithDuration:0.5 animations:^{
        _aView.transform = CGAffineTransformMakeScale(2, 2);
    }];
    
    //缩小
    [UIView animateWithDuration:0.5 animations:^{
        _aView.transform = CGAffineTransformScale(_aView.transform, 0.7, 0.7);
    }];

    //平移
    [UIView animateWithDuration:0.5 animations:^{
        _aView.transform = CGAffineTransformTranslate(_aView.transform, 10, 10);
    }];

  值得一提:『翻页效果』中的写法,别的都可以。

2016.01.22 简单动画

原文:http://www.cnblogs.com/immustard/p/5158469.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!