码迷,mamicode.com
首页 > 其他好文 > 详细

动画组合(uber启动时的等待效果)

时间:2015-07-31 10:47:19      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:ios   动画   

动画组合(uber启动时的等待效果)

by 伍雪颖


- (void)startAnimation {
   
self.layer.masksToBounds = 0;
   
self.layer.cornerRadius = 50;
   
if (self.layer.sublayers == nil) {
        [
self setUpAnimation];
    }
   
self.layer.speed = 1;
}

- (
void)setUpAnimation {
   
CABasicAnimation *posAnim = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    posAnim.
fromValue = @(0.01);
    posAnim.
toValue = @(1);
    posAnim.
duration = 1;
    posAnim.
timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
   
   
CABasicAnimation *opacity = [CABasicAnimation animationWithKeyPath:@"opacity"];
    opacity.
fromValue = @(1);
    opacity.
toValue = @(0);
    opacity.
duration = 1;
    opacity.
timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
   
   
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    animGroup.
animations = [NSArray arrayWithObjects:posAnim, opacity, nil];
    animGroup.
duration = 1;
    animGroup.
repeatCount = HUGE;
    [
self.layer addAnimation:animGroup forKey:nil];
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

动画组合(uber启动时的等待效果)

标签:ios   动画   

原文地址:http://blog.csdn.net/rainlesvio/article/details/47164937

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!