I have a loop that fires a function 30 times per second. The function changes the position of a couple of points that I use to animate. I draw lines through all the points, meaning that the lines will change 30 times per second.
I draw these lines to a CGLayer, which then is drawn to a UIView in the drawRect: method. I do this because I understand that performance is improved when drawing offscreen. However, it seems that the CGLayer saves all actual lines instead of drawn pixels, since even if I clear it, the program runs slower and slower over time when more lines are drawn.
I'm asking for other ways to animate this. What's the most efficient way and why?