CAEmitterCell

-( void )awakeFromNib
{
  CAEmitterLayer* fireEmitter = (CAEmitterLayer*) self .layer; ;
     fireEmitter.emitterPosition = CGPointMake ( .bounds.size.width/ 2 , .bounds.size.height);
fireEmitter.emitterMode =   kCAEmitterLayerOutline;
fireEmitter.emitterShape = kCAEmitterLayerLine;
 
fireEmitter.emitterSize = CGSizeMake 5 );
 
     float gas= .7 ;
     // Create the fire emitter cell
CAEmitterCell *fire = [CAEmitterCell emitterCell];
fire.emissionLongitude = M_PI ;
fire.emissionLatitude = - / ;
fire.BirthRate = 0 ; //100*gas;
fire.lifetime=gas;
fire.lifetimeRange=gas* 0 .35 ;
fire.VeLocity = 80 ;
fire.VeLocityRange = 21 ;
fire.EmissionRange = 1 .1 f;
fire.yacceleration = - 200 ;
fire.ScaleSpeed = .3 f;
fire.color=[[ UIColor colorWithRed: .8 green: .4 blue: .2 alpha: ] CGColor ];
fire.contents = ( id )[[ UIImage imageNamed: @"fire.png" CGImage ];
[fire setName: @"fire" ];
 
CAEmitterCell *smoke = [CAEmitterCell emitterCell];
smoke.BirthRate = //11;
smoke.emissionLongitude = - ;
smoke.emissionLatitude=- ;
smoke.lifetime = gas* 4 ;
smoke.VeLocity = 40 ;
smoke.VeLocityRange = 20 ;
smoke.emissionRange = / ;
smoke.Spin = 1 ;
smoke.SpinRange = 6 ;
smoke.yacceleration = - 160 ;
smoke.Scale = f;
smoke.AlphaSpeed = - .22 f;
smoke.ScaleSpeed = f;
smoke.color=[[ *gas] ];
 
smoke.contents = ( @"smoke.png" ];
[smoke setName: @"smoke" ];
 
fireEmitter.emitterCells = [ NSArray arrayWithObjects:smoke,fire,157)!important">nil ];
}

You can download Hanukkah Menorah on the app store Now for FREE. It supports both the iPad and iPhone. It also has some in-app-Purchases to change from the default menorah.

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...