ios常用的动画类

QuartzCore类库:

常用的类

CALayer 绘图的图层

CAAnimation 抽象的动画类,有一些基本的属性,时间函数等

CAPropertyAnimation 继承 CAAnimation 还是抽象类,抽象出一些keyPath之类的属性

CABasicAnimation继承自CAPropertyAnimation 顾名思义,基础的动画类,可以实现基础的动画了

CAKeyframeAnimation 继承自CAPropertyAnimation 关键针动画

CATransition继承自CAAnimation 封装了一些系统的动画,type,subType

CAAnimationGroup继承自CAAnimation 有animations的来组成动画组

 

CADisplayLink类似于NSTimer,按帧数来触发,默认系统帧数60/秒,那么可以设置每几帧触发一次,但是当CPU占用率较高的时候帧数打不到60次/秒,那么就会跳帧,有些触发被pass掉

 

CAGradientLayer 继承自CALayer,是一个做颜色渐变的Layer

CAShapeLayer继承自CALayer,可以划线,填充的层

CATransaction 对Layer做动画,begin ,commit 

CATransform3D CALayer 都有一个CATransform3D类型的transform属性,可对layer坐x,y,z轴的变换,以及opacity,frame等等,配合CATransaction可完成动画

 

CoreGraphics类库:

CGContext 类,绘图上下文

CGContextRef ctx = UIGraphicsGetCurrentContext();获取当前上下文

CGContextAdd.....创建一个什么,比如,矩形,圆形,曲线,line等等

CGContextSet......设置,比如StrokeColor,FillColor,lineWidth,alpha等等

用线绘制图形的时候要用

CGContextBeginPath(ctx);

CGContextMovetoPoint(point)将起始点移到一个点上

然后CGContextAddLineToPoint(pont1)划线

......

画好后执行CGContextClosePath(ctx);

最后画的时候:

CGContextFillPath(ctx);只是填充

CGContextDrawPath(ctx,kCGPathFillStroke)填充和线都画,后面的emun可以选择也可以跟上面一样的效果

CGAffineTransform是各种2D变化,UIView的transform属性就是这个类型

posted on 2015-04-05 13:48  wangyutao0424  阅读(361)  评论(0编辑  收藏  举报