但我希望像你在 www.findyourwaytooz.com看到的那样有一个缓慢的“星星”效果
我怎么能用CAEmitterCell做到这一点?
谢谢 :)
解决方法 我有一个项目,使用以下设置的发射器,它非常准确地模仿我认为你的意思://set ref to the layerstarsEmitter = (CAEmitterLayer*)self.layer; //2//configure the emitter layerstarsEmitter.emitterposition = CGPointMake(160,240);starsEmitter.emitterSize = CGSizeMake(self.supervIEw.bounds.size.wIDth,self.supervIEw.bounds.size.height);NSLog(@"wIDth = %f,height = %f",starsEmitter.emitterSize.wIDth,starsEmitter.emitterSize.height);starsEmitter.renderMode = kCAEmitterLayerPoints;starsEmitter.emitterShape = kCAEmitterLayerRectangle;starsEmitter.emitterMode = kCAEmitterLayerUnordered;CAEmitterCell* stars = [CAEmitterCell emitterCell];stars.birthRate = 0;stars.lifetime = 10;stars.lifetimeRange = 0.5;stars.color = [[UIcolor colorWithRed:255 green:255 blue:255 Alpha:0] CGcolor];stars.contents = (ID)[[UIImage imagenamed:@"particle.png"] CGImage];stars.veLocityRange = 500;stars.emissionRange = 360;stars.scale = 0.2;stars.scaleRange = 0.1;stars.AlphaRange = 0.3;stars.AlphaSpeed = 0.5; [stars setname:@"stars"];//add the cell to the layer and we're donestarsEmitter.emitterCells = [NSArray arrayWithObject:stars];
我将示例项目上传到GitHub:SimpleCAEmitterLayer
总结以上是内存溢出为你收集整理的ios – CAEmitterCell – 慢星或光效全部内容,希望文章能够帮你解决ios – CAEmitterCell – 慢星或光效所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)