0

I am using a CAEmitterCell to generate particles of a given image in various different colours:

CAEmitterCell *emitterCell = [CAEmitterCell emitterCell];
emitterCell.birthRate = 256;
emitterCell.lifetime = 3.0f;
emitterCell.lifetimeRange = 2.0f;
emitterCell.emissionRange = 2 * M_PI;
emitterCell.velocity = 1024;
emitterCell.contents = (__bridge id)myImage;
emitterCell.color = [NSColor whiteColor].CGColor;
emitterCell.redRange = 1.0;
emitterCell.greenRange = 1.0;
emitterCell.blueRange = 1.0;
emitterCell.alphaSpeed = -0.5;

This results in particles made of every colour. I want to limit this to only vary the hue of the colour while leaving the saturation and brightness the same (100% and 50% respectively) in order to create a more pleasant rainbow of colours.

Is it possible to do this using CAEmitterCell?

DanielGibbs
  • 9,910
  • 11
  • 76
  • 121
  • Are you saying that your code fluctuates color saturation and brightness? – El Tomato Dec 09 '15 at 03:49
  • The existing code seems to use uniformly distributed colours between `rgb(0.0, 0.0, 0.0)` and `rgb(1.0, 1.0, 1.0)`, so ends up with a variety of saturation and brightness. – DanielGibbs Dec 09 '15 at 03:56

0 Answers0