Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39348
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: New problem. Random colors to picture points with same distance as original... |
| Date | 2020-12-29 23:00 +0100 |
| Organization | PointedEars Software (PES) |
| Message-ID | <20902913.EfDdHjke4D@PointedEars.de> (permalink) |
| References | <9c826658-ec67-4f21-badf-7159371fb499n@googlegroups.com> <05dbc574-1b62-4eef-9ae8-76e877ae0172n@googlegroups.com> <12673259.uLZWGnKmhe@PointedEars.de> <d7626262-c2a1-4a33-a8fb-2f0097fcbeean@googlegroups.com> |
Kristjan Robam wrote:
> Thomas 'PointedEars' Lahn kirjutas pühapäev, 27. detsember 2020 kl
> 22:35:51 UTC+2:
[Attribution *line*, NOT attribution novel.]
>> <https://groups.google.com/g/comp.programming/c/ch6aYxj0_RI>
>>
>> Somebody is running there
>>
>> function aaaaa() {
>> // Canvas stuff
>> }
>>
>> setInterval(aaaaa, 1);
>>
>> (sic!)
>>
>> Of course it runs slow with a 1 ms (or in Gecko normalized to 10 ms)
>> interval.
>
> 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.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
New problem. Random colors to picture points with same distance as original... Kristjan Robam <jippii1291983@gmail.com> - 2020-12-27 08:04 -0800
Re: New problem. Random colors to picture points with same distance as original... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-27 09:03 -0800
Re: New problem. Random colors to picture points with same distance as original... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-12-27 21:35 +0100
Re: New problem. Random colors to picture points with same distance as original... Kristjan Robam <jippii1291983@gmail.com> - 2020-12-27 12:46 -0800
Re: New problem. Random colors to picture points with same distance as original... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-12-29 23:00 +0100
Re: New problem. Random colors to picture points with same distance as original... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-29 15:10 -0800
Re: New problem. Random colors to picture points with same distance as original... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-12-30 01:28 +0100
Re: New problem. Random colors to picture points with same distance as original... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-12-30 01:33 +0100
Re: New problem. Random colors to picture points with same distance as original... "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-12-29 19:16 -0800
Re: New problem. Random colors to picture points with same distance as original... H e <he12457@hotmail.com> - 2021-01-15 09:20 -0800
Re: New problem. Random colors to picture points with same distance as original... Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-01-16 00:48 +0100
Re: New problem. Random colors to picture points with same distance as original... Kristjan Robam <jippii1291983@gmail.com> - 2020-12-27 12:57 -0800
csiph-web