ios5 - iOS CAEmitterCell firework effect -
I want to create effects like fireworks. I know that I can use it for CAEmitterCell I tried to download some examples, but still is running with this feature in iOS 5.0
Any good tutorial knows that CAEmitterCell How can the fireworks effect be used?
I need to create something like this:
All particles are going from center to center (red circle) for green circles. The red circle is the starting point in which some CGPET values will be.
I have found this solution:
How does this look like the DWFParticleView.h file
#import & lt; UIKit / UIKit.h & gt; @ Interface DWPpartial view: UIVUE @ property (nonomatic) CG float time; - (zero) configurateEmmiter; - (zero) setEmitterPositionFromTouch: (UITouch *) T; - (zero) set ISMT: (BLL) editing and point: (CG point) point; @end How it looks DWFParticleView.m
#import "DWFParticleView.h" #import & lt; Quartzcore / Quartzcoreot & gt; @ Implementation DWFParticleView {CAEmitterLayer * fireEmitter; // 1} - (zero) configurateEmmiter {// define ref for layer layer = AMM = (CAmeterLayer *) itself Layer; // 2 // emitter layer fireEmitter.MitterPosition = CGPointMake (50, 50) Configure; FireEmitter.imitterSize = CGSizeMake (5, 5); CAEmitterCell * fire = [CAEmitterCell emitterCell]; Fire.birthRate = 0; Fire.lifetime = 2.0; Fire.lifetimeRange = 0.5; //fire.color = [[UIColor colorWithRed: 0.8 green: 0.4 blue: 0.2 alpha: 0.6] CGColor]; Fire.contents = (id) [[UIImage imageNamed: @ "star_icon.png"] CGImage]; [Fire setname: @ "fire"]; Fire Alkocity = 80; Fire.velocityRange = 20; Fire.emissionRange = M_PI * 2.0F; Fire.scaleSpeed = 0.1; Fire Spin = 0.5; // Add the layer to the cell and we are doing the fireEmitter.MitterCells = [NSArray arrayWithObject: fire]; FireEmitter.rendermode = kCAEmitterLayerAdditive; } + (Class) layer class {returns [caameterlayer class]; } - (zero) setEmitterPositionFromTouch: (UITouch *) T {// emitter status fireEmitter.emitterPosition = [location locationView: self]; } - (zero) set ISMTING: (BOOL) is emitting and point: (CG point) point {fireEmitter.emitterPosition = point; // Turn the emission of particles on / off [Firetime set value: [NSNumber number: What is it? 50: 0] Kapeeth: @ "Emitter Cellfish. Breitrett"]; [Self Performance Selector: Object with: @Selector (Dicestep): After zero: self. time]; } - (zero) decstep {[Firearm Set Value: [NSNumber NumberAttention: 0] For Kekpath: @ "Emitter Cellfish. Breitrett"]; } @end This is a tap on the screen, for example, which shows our effect
- (zero) tap {DWFParticleView * fireView = [[DWFParticleView Alloc] init]; FireView.time = 0.3; [Firewash set user interaction enabled: no]; [Fireview configured ammeter]; [Fireview setframe: CGRactack (0, 0, 0, 0)]; [Fireview setback color: [UIColor redColor]]; [Self.view addSubview: fireView]; } Content I have found here:
Comments
Post a Comment