CABasicAnimation之animationWithKeyPath方法
来源:互联网 发布:淘宝商家客服人工服务 编辑:程序博客网 时间:2024/05/16 18:45
CABasicAnimation中可以用animationWithKeyPath类方法来创建动画.其中keyPath的值有以下若干.
transform.scale = 比例转换
transform.scale.x = 闊的比例转换
transform.scale.y = 高的比例转换
transform.rotation.z = 平面图的转换
opacity = 透明度
margin = 布局
zPosition = 翻转
backgroundColor = 背景颜色
cornerRadius = 圆角
borderWidth = 边框宽
bounds = 大小
contents = 内容
contentsRect = 内容大小
cornerRadius = 圆角
frame = 大小位置
hidden = 显示隐藏
mask
masksToBounds
opacity
position
shadowColor
shadowOffset
shadowOpacity
shadowRadius
另附模仿音乐播放器的动画代码如下:
/// 添加动画- (void)addAnimation{ CABasicAnimation *monkeyAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; monkeyAnimation.toValue = [NSNumber numberWithFloat:2.0 *M_PI]; monkeyAnimation.duration = 20.0f; monkeyAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; monkeyAnimation.cumulative = NO; monkeyAnimation.removedOnCompletion = NO; //No Remove monkeyAnimation.fillMode = kCAFillModeForwards; monkeyAnimation.repeatCount = FLT_MAX; [self.imageView.layer addAnimation:monkeyAnimation forKey:@"AnimatedKey-ratation"]; [self.imageView stopAnimating]; self.imageView.layer.speed = 0.0;}
效果图
0 0
- CABasicAnimation之animationWithKeyPath方法
- CABasicAnimation animationWithKeyPath
- CABasicAnimation animationWithKeyPath property
- CABasicAnimation animationWithKeyPath 的类型
- CABasicAnimation animationWithKeyPath 的类型
- CABasicAnimation animationWithKeyPath Types
- CABasicAnimation animationWithKeyPath Types
- CABasicAnimation animationWithKeyPath Types
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值 .
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- iOS:CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- CABasicAnimation animationWithKeyPath 一些规定的值
- GA
- 函数名/函数地址/函数指针
- redis中使用 check-and-set 操作实现乐观锁
- centos7更改dns配置
- JAVA项目服务层总结
- CABasicAnimation之animationWithKeyPath方法
- 树莓派相关参数
- vmware horizon client for centos安装使用
- Python学习笔记5
- Caffe学习笔记《Training LeNet on MNIST with Caffe》
- 常见异常
- C# 配置文件
- 用css3画3d动画的思路
- JAVA项目控制层