iOS Animation各种动画效果

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

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值