Take the 2-minute tour ×

When I first set up the emitter I can do this:

self.cell = [CAEmitterCell emitterCell];
self.cell.yAcceleration = 20;
self.emitter.emitterCells = [NSArray arrayWithObjects:self.cell,nil];

But say I create a timer that fires 5 seconds later, and I do this:

- (void)timerFired
    self.cell.yAcceleration = -10;


The timer fires, but the yAcceleration of the CAEmitterCell does not get changed. Or at least nothing changes in the particle emission on screen. How can I get a CAEmitterCell to respect changes I make to its properties?

share|improve this question
add comment

1 Answer

This is not real obvious, but here's the solution:

[self.emitter setValue:[NSNumber numberWithFloat:-10.0]

Where "cell" is the name given here:

[self.cell setName:@"cell"];
share|improve this answer
I'm confused. Where does the [self.cell setName:@"cell"] line go, and where is it referenced above? Do you mean to say that it should be [self.cell setName:@"NAME"]; and then [self.emitter setValue:... forKeyPath:@"emitterCells.NAME.yAcceleration"]; The answer as it is written is confusing me because cell is such a generic term I wonder if you are modifying the key path? –  Cindeselia Mar 5 at 9:21
add comment

Your Answer


