关闭

iOS Animation各种动画效果

107人阅读 评论(0) 收藏 举报
分类:

//图片进度显示效果,什么时间点显示到什么程度

CAKeyframeAnimation* animation = [CAKeyframeAnimation animationWithKeyPath:@"strokeEnd"];
animation.duration = 1;
animation.values = @[@(0), @(1),@(0.75)];
animation.keyTimes = @[@(0), @(0.6), @(1)];
animation.repeatCount = 1;
[animation setRemovedOnCompletion:NO];
animation.fillMode = kCAFillModeForwards;
[_imageView.layer addAnimation:animation forKey:nil];


//图片从无到有显示动画效果

CABasicAnimation *basicAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
basicAnimation.duration = 2;
basicAnimation.fromValue = [NSNumber numberWithInteger:0];
basicAnimation.toValue = [NSNumber numberWithInteger:1];
[layer addAnimation:basicAnimation forKey:@"strokeEnd"];
[_imageView.layer addSublayer:layer];


//图片显示的各种动画效果

CATransition *animation = [CATransition animation];
[animation setDuration:1.0];
[animation setFillMode:kCAFillModeForwards];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]];
[animation setType:@"rippleEffect"];//@"cube" @"moveIn" @"reveal" @"fade"(default) @"pageCurl" @"pageUnCurl" @"suckEffect" @"rippleEffect" @"oglFlip"
[animation setSubtype:kCATransitionFromTop];
[_imageView.layer addAnimation:animation forKey:nil];


//图片位移之惯性效果

CASpringAnimation *animation = [CASpringAnimation animationWithKeyPath:@"position.x"];
animation.damping = 5;
animation.stiffness = 100;
animation.mass = 1;
animation.initialVelocity = 0;
animation.fromValue = _imageView.layer.position.x;
animation.toValue = _imageView.layer.position.x+200;
animation.duration = 3;
[_imageView.layer addAnimation:animation forKey:nil];





0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:4813次
    • 积分:315
    • 等级:
    • 排名:千里之外
    • 原创:28篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章分类