其他参考博客:

http://my.oschina.net/u/2340880/blog/485095

http://www.cnblogs.com/YouXianMing/p/3785876.html

CAEmitterLayer这个类是QuartzCore框架中针对CoreAnimation提供的一个粒子放射系统。这些粒子是由CAEmitterCell这个类进行实例化的。

一、Specifying Particle Emitter Cells (说明粒子发射器的cell)

Declaration:

/* The array of emitter cells attached to the layer. Each object must
* have the CAEmitterCell class. */ @property(nullable, copy) NSArray<CAEmitterCell *> *emitterCells;

Discussion:

Each object in the array must be an instance of the CAEmitterCell Class.

Avaliablility:

Avaliablility in iOS 5.0 and later.

二、Emitter Geometry (粒子几何)

(2.1)

RenderMode :Defines how particle cells are rendered into the CAMitterLayer.

Declaration:

/* A string defining how particles are composited into the layer's
* image. Current options are `unordered' (the default), `oldestFirst',
* `oldestLast', `backToFront' (i.e. sorted into Z order) and
* `additive'. The first four use source-over compositing, the last
* uses additive compositing. */ @property(copy) NSString *renderMode;

Discussion:

The possible values of render modes are shown in Emitter Modes. The default values is kCAEmitterLayerUnordered. // 无序的 e.g.

(2.2)

emitterPosistion:The position of the center of the particle emiiter. Animatable

Declaration:

/* The center of the emission shape. Defaults to (0, 0, 0). Animatable. */

@property CGPoint emitterPosition;

Discussion:

See Emitter Shape for details of how the emitterPosition related to the possible emitter shapes.

Default is (0.0, 0.0).

Availablility:

Available in iOS 5.0 and later.

(2.3)

emitterShape:Sepcifies the emitter shape.

Declaration:

/* A string defining the type of emission shape used. Current options are:
* `point' (the default), `line', `rectangle', `circle', `cuboid' and
* `sphere'. */ @property(copy) NSString *emitterShape;

Discussion:

The possible values for emitterMode are shown in Emitter Shape. The default value is kCAEmitterLayerPoint.

(2.4)

emitterZPosition:Specifies the center of the particle shape along the a-axis. Animatable.

Declaration:

@property CGFloat emitterZPosition;

Discussion:

See Emitter Shape for details of how the emitterZPosition relates to the possible emitter shapes.

(2.5)

emitterDepth:Determines the depath of the emitter shape.

Declaration:

@property CGFloat emitterDepth;

Discusstion:

How the emitter depth is applied depends on the emitter shape. See Emitter Shape for details. Depending on the value of emitterShape, this value may be ignored.

(2.6)

emitterSize:Determines the size of the particle emitter shape.

Declaration:

/* The size of the emission shape. Defaults to (0, 0, 0). Animatable.
* Depending on the `emitterShape' property some of the values may be
* ignored. */ @property CGSize emitterSize;

Discussion:

How the emitter size is applied depends on the emitter shape. See Emitter Shape for details. Depending on the value of emitteShaper, this value may be ignored.

三、Emitter Cell Attribute Multipliers

(3.1)scale:Defines a multiplier applied to the cell-defined particle scale.缩放比率

/* Multiplies the cell-defined particle scale. Defaults to one. Animatable. */

@property float scale;

(3.2)seed:Sepecifies the seed used to initialize the random number generator.

/* The seed used to initialize the random number generator. Defaults to
* zero. Each layer has its own RNG state. For properties with a mean M
* and a range R, random values of the properties are uniformly
* distributed in the interval [M - R/2, M + R/2]. */ @property unsigned int seed;

(3.3)spin:Defines a multiplier applied to the cell-defined particle spin.

/* Multiplies the cell-defined particle spin. Defaults to one. Animatable. */

@property float spin;

(2.4)velocity:Defines a multiplier applied to the cell-defined particle velocity.

/* Multiplies the cell-defined particle velocity. Defaults to one.
* Animatable. */ @property float velocity;

(2.5)birthRate:Defines a multiplier that is applied to the cell-defined birth rate. Animatable

/* The birth rate of each cell is multiplied by this number to give the
* actual number of particles created every second. Default value is one.
* Animatable. */ @property float birthRate;

Discussion:

The birth rate of each cell is multiplied by this number to give the actual number of particles created every second. Default value is 1.0.

(2.6)emitterMode:Specities the emitter mode.

/* A string defining how particles are created relative to the emission
* shape. Current options are `points', `outline', `surface' and
* `volume' (the default). */ @property(copy) NSString *emitterMode;

Discussion:

The possible values for emitterMode are shown in Emitter Modes. The default value is kCAEmitterLayerVolume.

(2.7)lifetime:Defines a multiplier applied to the cell-defined lifetime range when particles are created.

/* The cell lifetime range is multiplied by this value when particles are
* created. Defaults to one. Animatable. */ @property float lifetime;

(2.8)preservesDepth:Defines whether the layer flattens the particles into its plane.

/* When true the particles are rendered as if they directly inhabit the
* three dimensional coordinate space of the layer's superlayer, rather
* than being flattened into the layer's plane first. Defaults to NO.
* If true, the effect of the `filters', `backgroundFilters' and shadow-
* related properties of the layer is undefined. */ @property BOOL preservesDepth;

Discussion:

If YES, the layer renders its particles as if they directly inhabit the three-dimensional coordinate space of the layer’s superlayer. When enabled, the effect of the layer’s filters, backgroundFilters, and shadow related properties is undefined.

Default is NO.

CAEmitterLayer的类:

/* CoreAnimation - CAEmitterLayer.h

   Copyright (c) 2007-2015, Apple Inc.
All rights reserved. */ /* Particle emitter layer.
*
* Each emitter has an array of cells, the cells define how particles
* are emitted and rendered by the layer.
*
* Particle system is affected by layer's timing. The simulation starts
* at layer's beginTime.
*
* The particles are drawn above the backgroundColor and border of the
* layer. */ #import <QuartzCore/CALayer.h> @class CAEmitterCell; NS_ASSUME_NONNULL_BEGIN @interface CAEmitterLayer : CALayer /* The array of emitter cells attached to the layer. Each object must
* have the CAEmitterCell class. */ @property(nullable, copy) NSArray<CAEmitterCell *> *emitterCells; /* The birth rate of each cell is multiplied by this number to give the
* actual number of particles created every second. Default value is one.
* Animatable. */ @property float birthRate; /* The cell lifetime range is multiplied by this value when particles are
* created. Defaults to one. Animatable. */ @property float lifetime; /* The center of the emission shape. Defaults to (0, 0, 0). Animatable. */ @property CGPoint emitterPosition;
@property CGFloat emitterZPosition; /* The size of the emission shape. Defaults to (0, 0, 0). Animatable.
* Depending on the `emitterShape' property some of the values may be
* ignored. */ @property CGSize emitterSize;
@property CGFloat emitterDepth; /* A string defining the type of emission shape used. Current options are:
* `point' (the default), `line', `rectangle', `circle', `cuboid' and
* `sphere'. */ @property(copy) NSString *emitterShape; /* A string defining how particles are created relative to the emission
* shape. Current options are `points', `outline', `surface' and
* `volume' (the default). */ @property(copy) NSString *emitterMode; /* A string defining how particles are composited into the layer's
* image. Current options are `unordered' (the default), `oldestFirst',
* `oldestLast', `backToFront' (i.e. sorted into Z order) and
* `additive'. The first four use source-over compositing, the last
* uses additive compositing. */ @property(copy) NSString *renderMode; /* When true the particles are rendered as if they directly inhabit the
* three dimensional coordinate space of the layer's superlayer, rather
* than being flattened into the layer's plane first. Defaults to NO.
* If true, the effect of the `filters', `backgroundFilters' and shadow-
* related properties of the layer is undefined. */ @property BOOL preservesDepth; /* Multiplies the cell-defined particle velocity. Defaults to one.
* Animatable. */ @property float velocity; /* Multiplies the cell-defined particle scale. Defaults to one. Animatable. */ @property float scale; /* Multiplies the cell-defined particle spin. Defaults to one. Animatable. */ @property float spin; /* The seed used to initialize the random number generator. Defaults to
* zero. Each layer has its own RNG state. For properties with a mean M
* and a range R, random values of the properties are uniformly
* distributed in the interval [M - R/2, M + R/2]. */ @property unsigned int seed; @end /** `emitterShape' values. **/ CA_EXTERN NSString * const kCAEmitterLayerPoint
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerLine
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerRectangle
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerCuboid
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerCircle
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerSphere
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0); /** `emitterMode' values. **/ CA_EXTERN NSString * const kCAEmitterLayerPoints
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerOutline
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerSurface
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerVolume
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0); /** `renderMode' values. **/ CA_EXTERN NSString * const kCAEmitterLayerUnordered
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerOldestFirst
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerOldestLast
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerBackToFront
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0);
CA_EXTERN NSString * const kCAEmitterLayerAdditive
__OSX_AVAILABLE_STARTING (__MAC_10_6, __IPHONE_5_0); NS_ASSUME_NONNULL_END

CAEmitterLayer

iOS - CAEmitterLayer 学习笔记一的更多相关文章

  1. iOS音频学习笔记二:iOS SDK中与音频有关的相关框架

      上层:       Media Player Framework: 包含MPMoviePlayerController.MPMoviePlayerViewController.MPMusicPla ...

  2. iOS音频学习笔记一:常见音频封装格式及编码格式

    (1) pcm格式    pcm是经过话筒录音后直接得到的未经压缩的数据流    数据大小=采样频率*采样位数*声道*秒数/8     采样频率一般是22k或者44k,位数一般是8位或者16位,声道一 ...

  3. iOS开发学习笔记:基础篇

    iOS开发需要一台Mac电脑.Xcode以及iOS SDK.因为苹果设备都具有自己封闭的环境,所以iOS程序的开发必须在Mac设备上完成(当然,黑苹果应该也是可以的,但就需要花很多的精力去折腾基础环境 ...

  4. iOS开发学习笔记

    1 常用的第三方工具 1.1 iPhone Simulator 测试程序需要模拟器iPhone Simulator 1.2 设计界面需要Interface Builder,Interface Buil ...

  5. ios开发学习笔记(这里一定有你想要的东西,全部免费)

    1,Search Bar 怎样去掉背景的颜色(storyboard里只能设置background颜色,可是发现clear Color无法使用). 其实在代码里还是可以设置的,那就是删除背景view [ ...

  6. iOS开发应用学习笔记

    一.iOS应用设计 1. 参考资料: 解读iPhone平台的一些优秀设计思路 iPhone App的特点及基本设计方法 Mobile UI design and Developer 2. 用户对iPh ...

  7. ios 框架学习笔记

    ios主要的系统层次: 一.Cocoa Touch 层:创建应用程序主要使用的框架. 1.关键技术: AirDrop:实现应用间通信. Text Kit:处理文本和排版. UIKit Dynamics ...

  8. ios 存储学习笔记

    一.主要路径: Library/Caches/此文件用于存储那些需要及可延迟或重创建的临时数据.且这些内容不会被IOS 系统备份,特别地,当设备磁盘空间不足且应用不在运行状态时,IOS 系统可能会移除 ...

  9. (ios开发学习笔记一)ios项目文件结构

    转自:http://www.cnblogs.com/macroxu-1982/archive/2012/07/31/2616389.html 下面是单个窗体项目例子,我们从这个项目开始,说明ios项目 ...

随机推荐

  1. ul、li模仿ios的TableView实现城市选择

    最近项目一个接着一个,之前说的精创环的项目还没做完,今天说先把那个放一下,先做访客系统,销售会见客户之后可以对客户进行一个跟踪记录,原型图也给了,今日头条的频道自定义页面一样. 如果是在IOS上让我来 ...

  2. jquery图片轮播效果(unslider)

    今天做网站(住建局网站)需要用到图片轮播,刚开始想借鉴DTCMS上的,查看CSS与页面代码,呵呵,不复杂,直接复制过来,结果调整半天,页面还是各种乱,没办法,网上找一个吧,于是找到了今天要说的这货un ...

  3. coursera 公开课 文本挖掘和分析(text mining and analytics) week 1 笔记

    一.课程简介: text mining and analytics 是一门在coursera上的公开课,由美国伊利诺伊大学香槟分校(UIUC)计算机系教授 chengxiang zhai 讲授,公开课 ...

  4. 1-mkdir 命令总结

    mkdir make directories 创建目录 [语法]: ls [选项] [参数] [功能介绍] mkdir命令用来创建目录.该命令创建由dirname命名的目录.如果在目录名的前面没有加任 ...

  5. C#中的interface

    接口(interface) 接口泛指实体把自己提供给外界的一种抽象化物(可以为另一实体),用以由内部操作分离出外部沟通方法,使其能被修改内部而不影响外界其他实体与其交互的方式. 接口实际上是一个约定: ...

  6. Android基础知识总结

    四大组件之一活动 活动状态 运行状态:活动处于栈顶 暂停状态:活动不处于栈顶,但仍然可见 停止状态:完全不可见 销毁状态:离开返回栈 生存期 onCreate() onStart():不可见到可见调用 ...

  7. Mybatis 异常: The content of elements must consist of well-formed character data or markup

    原因很简单:在ibatis的配置文件中不能出现小于号(>)     <delete id="deleteByPrimaryKey" parameterType=&quo ...

  8. git 常用命令使用

    1. 初始化仓库 git init 2. 查看当前状态 git status(1)Changes not staged for commit:(2)Changes to be committed: 3 ...

  9. 【HDU 2089】不要62

    http://acm.hdu.edu.cn/showproblem.php?pid=2089 数位dp,参照了打野的博客 预处理出f数组,f[i][j]表示第i位为数字j时的可行的数字总数. 对于区间 ...

  10. eclipse安装ADT

    ADT安卓开发工具安装 ADT(Android Development Tools)安卓开发工具,是安卓在Eclipse IDE环境中的开发工具,为Android开发提供开发工具的升级或者变更,简单理 ...