caemitterlayer

CAEmitterLayer emits random unwanted particles on touch events

偶尔善良 提交于 2019-12-03 05:28:20
问题 I'm trying to set up a CAEmitterLayer to make a confetti effect, and I've run into two issues: Whenever I set the birthRate on my cells to something non-zero to start the animation I get a flurry of cells placed randomly on screen, which animate normally, and then the emitter continues to emit properly after that. Whenever the emitterCells are drawing things on screen, any time I touch the screen, the emitter draws emitterCells in (seemingly) random locations that exist for a (seemingly)

CAEmitterLayer emits random unwanted particles on touch events

ぐ巨炮叔叔 提交于 2019-12-02 19:56:29
I'm trying to set up a CAEmitterLayer to make a confetti effect, and I've run into two issues: Whenever I set the birthRate on my cells to something non-zero to start the animation I get a flurry of cells placed randomly on screen, which animate normally, and then the emitter continues to emit properly after that. Whenever the emitterCells are drawing things on screen, any time I touch the screen, the emitter draws emitterCells in (seemingly) random locations that exist for a (seemingly) random amount of time. Nothing in the emitter is tied to any touch events (i.e. I'm not intentionally

CAEmitterLayer not rendering when -renderInContext: of superlayer is called

不羁岁月 提交于 2019-12-01 17:39:07
I have a drawing app and I would like for my users to be able to use particle effects as part of their drawing. Basically, the point of the app is to perform custom drawing and save to Camera Roll or share over the World Wide Web. I encounted the CAEmitterLayer class recently, which I reckon would be a simple and effective way to add particle effects. I have been able to draw the particles onscreen in the app using the CAEmitterLayer implementation. So rendering onscreen works fine. When I go about rendering the contents of the drawing using CGContextRef context =

CAEmitterLayer not rendering when -renderInContext: of superlayer is called

☆樱花仙子☆ 提交于 2019-12-01 16:27:15
问题 I have a drawing app and I would like for my users to be able to use particle effects as part of their drawing. Basically, the point of the app is to perform custom drawing and save to Camera Roll or share over the World Wide Web. I encounted the CAEmitterLayer class recently, which I reckon would be a simple and effective way to add particle effects. I have been able to draw the particles onscreen in the app using the CAEmitterLayer implementation. So rendering onscreen works fine. When I go

Initial particles from CAEmitterLayer don't start at emitterPosition

穿精又带淫゛_ 提交于 2019-12-01 03:18:42
My goal is to make an explosion-like animation where many particles are emitted in a short duration. My problem is that CAEmitterLayer, when it begins emitting, adds "future" particles to make it looks like the animation has been running for a while. How can I disable or workaround this? When I increase the birthRate, I only want particles to start appearing from the emitterPosition, and not at all points along the CAEmitterCell's projected lifetime. Any help is appreciated. #import "EmitterView.h" @interface EmitterView () @property CAEmitterLayer* emitter; @end @implementation EmitterView -

iOS 7 CAEmitterLayer spawning particles inappropriately

五迷三道 提交于 2019-11-29 20:29:20
Strange issue I can't seem to resolve where on iOS 7 only, CAEmitterLayer will spawn particles on the screen incorrectly when birth rate is initially set to a nonzero value. It's as if it calculates the state the layer would be in the future. // Create black image particle CGRect rect = CGRectMake(0, 0, 20, 20); UIGraphicsBeginImageContext(rect.size); CGContextFillRect(UIGraphicsGetCurrentContext(), rect); UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); // Create cell CAEmitterCell *cell = [CAEmitterCell emitterCell]; cell.contents = (__bridge id)img

iOS 7 CAEmitterLayer spawning particles inappropriately

廉价感情. 提交于 2019-11-28 16:34:18
问题 Strange issue I can't seem to resolve where on iOS 7 only, CAEmitterLayer will spawn particles on the screen incorrectly when birth rate is initially set to a nonzero value. It's as if it calculates the state the layer would be in the future. // Create black image particle CGRect rect = CGRectMake(0, 0, 20, 20); UIGraphicsBeginImageContext(rect.size); CGContextFillRect(UIGraphicsGetCurrentContext(), rect); UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext()

UIView self.layer.shouldRasterize = YES and performance issues

空扰寡人 提交于 2019-11-27 19:51:57
I would like to share my experience from using self.layer.shouldRasterize = YES; flag on UIViews. I have a UIView class hierarchy that has self.layer.shouldRasterize turned ON in order to improve scrolling performance ( all of them have STATIC subviews that are larger than the screen of the device ). Today in one of the subclasses I used CAEmitterLayer to produce nice particle effects. The performance is really poor although the number of particles was really low (50 particles) . What is the cause of this problem? I'll just quote Apple Doc and explain: @property BOOL shouldRasterize When the

UIView self.layer.shouldRasterize = YES and performance issues

无人久伴 提交于 2019-11-26 19:54:28
问题 I would like to share my experience from using self.layer.shouldRasterize = YES; flag on UIViews. I have a UIView class hierarchy that has self.layer.shouldRasterize turned ON in order to improve scrolling performance ( all of them have STATIC subviews that are larger than the screen of the device ). Today in one of the subclasses I used CAEmitterLayer to produce nice particle effects. The performance is really poor although the number of particles was really low (50 particles) . What is the