CABasicAnimation动画
来源:互联网 发布:云盘 网站维护源码 编辑:程序博客网 时间:2024/05/17 01:43
- (void)viewDidLoad {
[superviewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
_redLayer = [CALayerlayer];
[_redLayersetFrame:CGRectMake(50,50, 100,100)];
[_redLayersetBackgroundColor:[UIColorredColor].CGColor];
[self.view.layeraddSublayer:_redLayer];
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
//1
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
// animation.toValue = [NSValue valueWithCGPoint:CGPointMake(100, 100)];
// animation.toValue = [NSValue valueWithCGPoint:CGPointMake(200, 200)];
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO; //这句必须有不然回到原来的位置
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//2
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform"];
// animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeRotation(M_PI_2, 0, 0, 1)];
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//3
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
// animation.toValue = @(M_PI_2);
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//等价于 (3和4)
//4
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
// animation.toValue = @(M_PI_2);
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//5
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale.xy"];
// animation.toValue = @(0.5);
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//等价于 (5和6)
//6
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
// animation.toValue = @(0.5);
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
//7
// CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
// animation.toValue = @(100);
// [animation setDuration:2.0];
// animation.removedOnCompletion = NO;
// [animation setFillMode:kCAFillModeForwards];
// [self.redLayer addAnimation:animation forKey:nil];
}
- CABasicAnimation 动画
- CABasicAnimation 动画
- CABasicAnimation 动画
- CABasicAnimation 动画
- CABasicAnimation 动画
- CABasicAnimation动画
- CABasicAnimation动画
- CABasicAnimation:动画
- CABasicAnimation 基本动画学习
- CABasicAnimation动画的解析
- CABasicAnimation 基本动画学习
- CABasicAnimation 基本动画学习
- CABasicAnimation 基本动画学习
- CABasicAnimation 热门动画效果
- CABasicAnimation 动画效果
- CABasicAnimation 基本动画学习
- 动画CATransition、CABasicAnimation
- CABasicAnimation 基本动画
- 【炼成版】Ubuntu 14.04.3+CUDA 7.5+Theano 0.7 安装整理
- 细说五层网站架构 【转】
- IOS-学习笔记(4)
- SQL表连接和JDBC初步
- 【摘要与笔记1】-单层感知器,两层神经网络与深度学习
- CABasicAnimation动画
- NYOJ 171 聪明的kk 【动态规划入门】
- 【深度学习与Theano】LSTM理解
- Android版本与API Level的对应关系
- Java字符串简单练习
- 【深度学习与Theano】Theano学习之初体验
- 【深度学习与Theano】LSTM网络-情感分析
- 1029. 旧键盘(20)
- LeetCode 53. Maximum Subarray