有关动画,我们可能用UIView的动画,或是会用到CABasicAnimation比较多一点.
有关CAAnimation的基础知识结构图,我简单画了个图
CABasicAnimation通过设置keyPath来设置类型
duration:动画时长
fromValue/toValue 动画起始位置,根据keypath不同,传值不同.
reaptCount重复次数
设置动画在执行结束后不返回原来位置需设置:
removedOnCompletion = NO position.fillMode = kCAFillModeForwards;
keypath属性
transform.scale = 比例转换
transform.rotation = 旋转
transform.rotation.x = x轴旋转
transform.rotation.y = y轴旋转
opacity = 透明度
margin = 边距
position = 位移
backgroundColor = 背景颜色
cornerRadius = 圆角
borderWidth = 边框宽度
bounds = 位置,体积
contents =