I'm making a particle effect in a UIView and it looks ok in iOS7, but in 8 it leaves fragments of particles on the screen if the lifetime is too long.
The effect is a sort of explosion and I defined it as follows:
CAEmitterCell* emitterCell = [CAEmitterCell emitterCell];
emitterCell.birthRate = 45;
emitterCell.lifetime = 1.05; // 1.35 is the desired lifetime
emitterCell.lifetimeRange = 0.5;
emitterCell.contents = (id)[[UIImage imageNamed:@"particle_y_1"] CGImage];
emitterCell.velocity = 50;
emitterCell.velocityRange = 20;
emitterCell.spin = 6.0;
emitterCell.spinRange = 1.0;
emitterCell.emissionRange = M_PI*2;
emitterCell.alphaSpeed = -0.30;
emitterCell.scale = 0.5;
emitterCell.scaleRange = 0.2;
emitterCell.scaleSpeed = -0.5;
[emitterCell setName:@"spark"];
_particleEmitter.emitterCells = [NSArray arrayWithObject:emitterCell];
[self performSelector:@selector(disableEmitter) withObject:nil afterDelay:0.1];
the disableEmitter method just sets the birthrate to 0.
The code above leaves no fragments, but that is apparently 1.05 is as high as I can go.
So far I've tried tweaking the view's size, hiding it and clearing the layer's emitter cells and removing it from the superlayer and nothing worked.
I'd appreciate some help :)
Aucun commentaire:
Enregistrer un commentaire