0

Im trying to figure out if there is a better way to draw a fading line then the method that I am currently using.

Currently to draw a fading line that can be moved around the screen I am using SKEmitterNodes. The SkEmitterNodes however are extremely CPU expensive. They have a birth rate of 300 to be able to maintain a thick line while being moved around the screen. Does anyone know of a better way to achieve this fading line drawing effect better?

The effect I am looking for is similar to the lines being drawn in Dark Echo. Here is a video. https://www.youtube.com/watch?v=tuOC8oTrFbM

Thanks, Chris

Chris Brasino
  • 296
  • 2
  • 14

1 Answers1

-1

If you are looking to fade a node's alpha property then you can use (SKAction *)fadeOutWithDuration:(NSTimeInterval)sec. This will gradually fade your node's alpha to zero in the specified time frame.

For proper memory management you should remove the node from parent if you no longer need it and the alpha has reached zero.

sangony
  • 11,636
  • 4
  • 39
  • 55
  • 1
    No I'm looking to create a line with a fading tail. Similar to the game Dark Echo has lines bouncing around the screen with fading tails. Here is a video of the effect. https://www.youtube.com/watch?v=tuOC8oTrFbM – Chris Brasino Apr 21 '15 at 15:31
  • @ChrisBrasino - Take a look at this previous answer involving a fading smoke trial. http://stackoverflow.com/questions/29137947/spritekit-and-opengl-smooth-smoke-trail – sangony Apr 21 '15 at 15:56
  • Thanks that clarifies a bit. I think i will need to use a CGPath, convert it to a CGStrokedPath and then apply a gradient like this is suggesting, http://stackoverflow.com/questions/2737973/on-osx-how-do-i-gradient-fill-a-path-stroke/2770034#2770034 – Chris Brasino Apr 21 '15 at 16:05