caleb531 / jcanvas

A jQuery plugin that makes the HTML5 canvas easy to work with.
https://projects.calebevans.me/jcanvas/
MIT License
626 stars 192 forks source link

Animations are very CPU intensive #345

Closed KevsRepos closed 5 years ago

KevsRepos commented 5 years ago

I am using jCanvas v. 21.0.1 Have a Intel Core i5 8th Gen with 1.60 Ghz Are there any tricks to run animations without affecting the cpu too much? My processor utilization goes up to 35% only when I run 3 easy animations like:

$('canvas').animateLayerGroup('toolObjects', { rotate: '+=1400' }, duration);

It gets worse when the animations repeat. Is it possible to increase the cpu utilization?

caleb531 commented 5 years ago

@MyKevMal How many layers are in your layer group? That will be a major factor in how much processing power this takes. animateLayerGroup animates each layer independently (because, well, it has to—if each layer has a different starting rotate value, then there's no easy way to coalesce the animation calculations into one).