//#import <QuartzCore/QuartzCore.h>
//创建粒子发射器
layer = [CAEmitterLayer layer];
[self.view.layer addSublayer:layer];
//发射口个数(默认1)
layer.birthRate = 1;
//发射口大小
layer.emitterSize = CGSizeMake(50, 50);
//发射口位置
layer.emitterPosition = CGPointMake(0, 0);
// layer.emitterZPosition = 50;
// “指向’ (默认值)右, “线路’上, “长方形’, “圈子’, “长方体’和* “球形’。 *
layer.emitterShape = kCAEmitterLayerLine;
//发射类型
layer.renderMode = kCAEmitterLayerAdditive;
//粒子
CAEmitterCell * cell = [CAEmitterCell emitterCell];
//每秒150个粒子
cell.birthRate = 150;
//生命周期
cell.lifetime = 0.5;
//生命周期+-0.3秒
cell.lifetimeRange = 0.3;
//图片
cell.contents = (id)[UIImage imageNamed:@"snow1.png"].CGImage;
//发射扇形大小
cell.emissionRange = (25/180.0)*M_PI;
//移动速度pt/s
cell.velocity = 400;
//偏移
cell.velocityRange = 100;
//粒子自传
cell.spin = 1;
//粒子大小递增比例
cell.scale = 1;
//发射粒子
layer.emitterCells = [NSArray arrayWithObjects:cell, nil];
//创建粒子发射器
layer = [CAEmitterLayer layer];
[self.view.layer addSublayer:layer];
//发射口个数(默认1)
layer.birthRate = 1;
//发射口大小
layer.emitterSize = CGSizeMake(50, 50);
//发射口位置
layer.emitterPosition = CGPointMake(0, 0);
// layer.emitterZPosition = 50;
// “指向’ (默认值)右, “线路’上, “长方形’, “圈子’, “长方体’和* “球形’。 *
layer.emitterShape = kCAEmitterLayerLine;
//发射类型
layer.renderMode = kCAEmitterLayerAdditive;
//粒子
CAEmitterCell * cell = [CAEmitterCell emitterCell];
//每秒150个粒子
cell.birthRate = 150;
//生命周期
cell.lifetime = 0.5;
//生命周期+-0.3秒
cell.lifetimeRange = 0.3;
//图片
cell.contents = (id)[UIImage imageNamed:@"snow1.png"].CGImage;
//发射扇形大小
cell.emissionRange = (25/180.0)*M_PI;
//移动速度pt/s
cell.velocity = 400;
//偏移
cell.velocityRange = 100;
//粒子自传
cell.spin = 1;
//粒子大小递增比例
cell.scale = 1;
//发射粒子
layer.emitterCells = [NSArray arrayWithObjects:cell, nil];