我正在尝试使用UIKit CAEmitterLayer在用户触摸屏幕时向用户提供反馈。 我想做的是一个粒子圈,它会随着时间的推移而增长。
我在想,如果我以相同的速度设置粒子(没有速度范围),粒子将以相同的速度从中心点移动,因此画一个圆圈。
然而,看起来速度仍然是随机的,在0和我选择的速度之间的范围内。
有没有办法强制速度成为一个确切的值?
dragEmitter.emitterPosition = CGPointMake(50, 50);
dragEmitter.emitterSize = CGSizeMake(1, 1);
CAEmitterCell* fire = [CAEmitterCell emitterCell];
fire.birthRate = 10;
fire.lifetime = 0.7;
fire.lifetimeRange = 0;
fire.color = [[UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0] CGColor];
fire.contents = (id)[[UIImage imageNamed:@"Particles_fire.png"] CGImage];
[fire setName:@"fire"];
fire.velocity = 50;
fire.velocityRange = 0;
fire.emissionRange = 2*M_PI;
fire.emissionLatitude = 0;
fire.emissionLongitude = 0;
谢谢你的帮助!
答案 0 :(得分:0)
.
.
emitter.emitterPosition = CGPointMake(...);
emitter.renderMode = kCAEmitterLayerBackToFront;
CAEmitterCell* star = [CAEmitterCell emitterCell]
star.emissionLongitude = M_PI*2;
star.emissionRange = M_PI*2;
star.lifetime = 2.5;
star.birthRate = 20;
star.velocity = 120;
star.velocityRange = 20;
star.color = [UIColor colorWithRed:49.0/255.0 green:168.0/255.0 blue:181.0/255.0 alpha:0.6].CGColor;
star.contents = (id)image.CGImage;
star.redRange = 0.1;
star.greenRange = 0.1;
star.blueRange = 0.1;
.
.