0

我正在使用 aCAEmitterCell来生成各种不同颜色的给定图像的粒子:

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;

这导致颗粒由每种颜色制成。我想将其限制为仅改变颜色的色调,同时保持饱和度和亮度相同(分别为 100% 和 50%),以创建更令人愉悦的彩虹色。

是否可以使用 来做到这一点CAEmitterCell

4

0 回答 0