Questions tagged [caemitterlayer]

The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell.

The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell. Inherits from CALayer : NSObject

CAEmitterLayer Class Reference: Official Apple Documentation

98 questions
6
votes
1 answer

CAEmitterLayer: Using an @2x (retina) png image with CAEmitterCell

Using CAEmitterLayer, @2x (retina) images aren't being scaled property like they do elsewhere in iOS. The result I'm getting is the @2x version is being displayed 4x the size of the non-retina image instead of being scaled down. Any idea of how to…
W Dyson
  • 4,604
  • 4
  • 40
  • 68
6
votes
2 answers

CAEmitterLayer not rendering when -renderInContext: of superlayer is called

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…
micksabox
  • 113
  • 6
6
votes
1 answer

iOS: capturing CAEmitterLayer particles on screen

Is there a way to capture CAEmitterCells (generated using a CAEmitterLayer) when capturing the ios device screen? UIGetScreenImage() works, but since it's a private method im not allowed to use it. UIGraphicsBeginImageContext doesn't seem to work,…
Zoltán Matók
  • 3,923
  • 2
  • 33
  • 64
6
votes
1 answer

How to control CAKeyframeAnimation with touch gesture?

I have a CAEmitterLayer animated along a bezier path (closed form, like an '8', out of four control points) with a CAKeyframeAnimation. Now I want to control the animation by a slide of a touch-finger along (but not necessarily on) the path. How is…
headkit
  • 3,307
  • 4
  • 53
  • 99
5
votes
2 answers

Running CAEmitterLayer only once

I want to run CAEmitterLayer only once, I was thinking of stopping birthRate but I can't do it. What I want is for it to run only once when tapping on the screen. I've been trying with delegates but I can't get it to work. And could you please tell…
5
votes
1 answer

Screenshot View with CAEmitterLayer

Is it possible to take a screenshot of a view that includes a CAEmitterLayer? Whenever I try, the view is created fine, but all of the particles are missing, here's my code: UIGraphicsBeginImageContext(drawingView.frame.size) var…
Chris
  • 2,739
  • 4
  • 29
  • 57
4
votes
1 answer

CAEmitterLayer not timing correctly with CACurrentMediaTime() and sometimes not showing at all

I am currently making a particle emitter using CAEmitterLayer and ran into the issue of the layer preloading the animation when I start it and hence the particles all over the place when I show it. Many answers have said the culprit is…
Roodey
  • 55
  • 8
4
votes
4 answers

How to set CAEmitterLayer background transparent?

var emitter = CAEmitterLayer() emitter.emitterPosition = CGPoint(x: self.view.frame.size.width / 2, y: -10) emitter.emitterShape = kCAEmitterLayerLine emitter.emitterSize = CGSize(width: self.view.frame.size.width, height: 2.0) …
Darshit Shah
  • 2,366
  • 26
  • 33
4
votes
1 answer

iOS create falling leaves animations using CAEmitterLayer

I want to create a leaves falling animation this is my code : private func setupEmitter() { let size = self.bounds.size let emitter = CAEmitterLayer() emitter.emitterSize = CGSize(width: size.width, height: 1) …
Chlebta
  • 3,090
  • 15
  • 50
  • 99
4
votes
2 answers

CAEmitterLayer VERY SLOW

I am designing a particle system using Apple's CAEmitterLayer and CAEmitterCell and everything is going GREAT on the iPhone5 and simulator. But as soon as I run it on an iPhone4S the particle system kills the FPS. Now I tried decreasing the amount…
Parad0x13
  • 2,007
  • 3
  • 23
  • 38
4
votes
2 answers

How to remove an CAEmitterLayer?

I'm playing with particle system in iOS using CAEmitterLayer (like in this example) but i can't remove the particles when i want. I'm trying the following code but it doesn't work: [self.emitterLayer setLifetime:0]; [self.emitterLayer…
Fran Fox
  • 575
  • 1
  • 4
  • 5
3
votes
1 answer

How to use CAEmitterLayer on macOS in a SwiftUI app using NSViewRepresentable

I want to use a CAEmitterLayer within a macOS app that is based on SwiftUI. Problem: The layer itself is perfectly visible, but it doesn’t emit any particles. → Here’s my demo project on GitHub I basically built a NSViewRepresentable for a custom…
ixany
  • 5,433
  • 9
  • 41
  • 65
3
votes
1 answer

iOS (Swift) Changing a property of a CAEmitterCell after it's been initialised

My aim is to create a fire effect using a CAEmitterLayer, whose strength can be altered via changing the value of the alphaSpeed property of its given CAEmitterCells. A smaller value of the alphaSpeed would result in a "roaring" fire, whilst a…
ajrlewis
  • 2,968
  • 3
  • 33
  • 67
3
votes
0 answers

CAEmitterCell automatically stop to emitting after sometime

CAEmitterCell emitting for 2 to 3 minutes but after it stops to emitting automatically. So my question is how can I set CAEmitterCell so that it will emitting infinite. Is there is a way to continuously emitting the CAEmitterCell or Is there any…
Jagat Dave
  • 1,643
  • 3
  • 23
  • 30
3
votes
1 answer

CAEmitterCell without using an image?

I'm having trouble finding enough documentation on CAEmitterCell. It's contents seem to be able to set to any object, but as far as I can tell from examples online it's always been set to an UIImage. Is there any way to set anything else to the…
Vadoff
  • 9,219
  • 6
  • 43
  • 39