I am trying to get CAEmitterLayer and CAEmitterCell to start their animation somewhere in the middle of their parent duration. Is it even possible? I tried to play with the beginTime and timeOffset , but I can't get this to work.
Added code for posterity: (let's say I want the emitter to start from the 5th second)
CAEmitterLayer *emitter = [CAEmitterLayer new]; // emitter.beginTime = -5.0f; // I tried this // emitter.timeOffset = 5.0f; // I also tried this, with beginTime = 0.0, and with beginTime = AVCoreAnimationBeginTimeAtZero /* set some other CAEmitterLayer properties */ CAEmitterCell *cell = [CAEmitterCell new]; // cell.beginTime = -5.0f; // Then I saw that CAEmitterCell implements CAMediaTiming protocol so I tried this // cell.timeOffset = 5.0f; // and this /* set some other CAEmitterCell properties */ emitter.emitterCells = @[cell]; [viewLayer addSubLayer:emitter];
But the animation starts from the moment when the emitter generates particles.
Edited again to explain what I'm trying to do:
Say I have a CAEmitterLayer that animates rain, so I'm setting up cells to create a falling animation that starts from the top of the screen. At the start of rendering, I donβt want to start with a state that "it is not raining yet." I want to start when the screen is already covered in rain.
source share