title: Most efficient way to draw particles in HTML5 on iPad 2
body: <p>I'm trying to create moving lights with trails for an HTML5 website/app targeted at iPad 2.
  I wonder what the best way to do this is and whether using HTML5 is viable at all. I chose HTML5 because it's easier and cheaper to develop and deploy than native iOS apps with Objective C. Of course if it turns out that HTML5 simply doesn't offer enough performance I might have to swallow the bitter pill.</p>
  
  <p>Anyway to give you an impression what I'm talking about, this is what I got so far:</p>
  
  <p><a href="http://devdali.no-ip.org/mathias/test-lights/screenshots/1.jpg" rel="noreferrer">screenshot http://devdali.no-ip.org/mathias/test-lights/screenshots/1.jpg</a></p>
  
  <p>Or you can see it in action <a href="http://devdali.no-ip.org/mathias/test-lights/frame.html" rel="noreferrer">here</a> (only works in webkit based browsers).</p>
  
  <p>At first I tried using HTML5 canvas and drawing radial gradients as particles in similar manner you see above. It worked but the framerate was horrible even on my desktop computer!</p>
  
  <p>So after a bit of reading I found out that CSS3 transforms may be hardware accelerated, so I build the version you see above. Every "particle" is a 64x64 png image. For each light there is the "head" light (one img) followed by a trail consisting of 115 img elements. Each img element is transformed using "translate3d" (as well as scale and rotation). Also the opacity of each element is adjusted dynamically. </p>
  
  <p>Doing it this way provided much better framerates on my computer, but I doubt the iPad 2 will handle it.</p>
  
  <p>I'd be grateful if anyone could give me some hints on how to improve the performance of this in general and considering the target platform.</p>
  
  <p>Thanks for any help in advance!</p>