Kristjan Robam wrote:
> Thomas 'PointedEars' Lahn kirjutas pühapäev, 27. detsember 2020 kl
> 22:35:51 UTC+2:
[Attribution *line*, NOT attribution novel.]
> Yes.
>
> This is it, but there is one problem.
> The transitions are not good.
> They should be smooth.
[Please trim your quotes to *the relevant minimum*.]
Smooth animations should not be programmed using a tight loop or Interval,
but with one of
A) reasonable values for the Interval (≥ 10 ms);
B) a reasonable delay (≥ 10 ms) for the timeout for the next animation
frame (I have written a library that does this; I guess other
people, too);
C) <
https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame>
D) CSS transitions/animations, perhaps with SVG, instead of Canvas.
Lack of smoothness in an animation can also be due to software-based
rendering instead of hardware acceleration being used. A possibility that
would likely lead to the use of hardware acceleration (if the suitable
graphics hardware and driver are present, and the feature is enabled in
the user agent) is
var ctx = canvas.getContext('webgl');
or
var ctx = canvas.getContext('webgl2');
<
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext>
However, I am not well-versed in Canvas (I prefer SVG), and I do not know
how suitable those would be in this case.