loktar00/JQuery-Snowfall

Change Positioning from top/left to transform

IchordeDionysos opened this issue · 2 comments

It is much better for moving objects to use transform: translate(x, y) instead of absolute positioning with top & left, because changing the top and left attributes it needs Chrome to process 3 operations:

  1. It have to process the layout, because top/left may affect other elements on the page
  2. Damaged Pixels have to be repainted
  3. The Composition has changed so it has to calculate over this step too

A much better choice is to use the transform attribute instead, because this attribute doesn't affect other elements and so no pixels can be damaged and you only have to change your Composition.

It would be a great enhancement.
I saw pages using your Plugin and forced them to FPS under 30 and sometimes 20.

I hope I could help you!

For more information:
http://csstriggers.com/#top
http://csstriggers.com/#transform

Oh well I saw you merged a pull request with this issue to the snowfall.js, I just saw the jquery version, where you still work with top and left!

eh yeah I need to keep up more with this plugin honestly, having the two separate versions is kind of weird since they have had a tendency to go their own way. Doing it with a canvas overlay might even be the most performant option but I haven't directly compared the two.

Anyway you're right I just didn't get to actually updating the JQ version after merging the pull request.