Path: csiph.com!weretis.net!feeder8.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.190.227.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: New problem. Random colors to picture points with same distance as original... Date: Tue, 29 Dec 2020 23:00:42 +0100 Organization: PointedEars Software (PES) Lines: 64 Message-ID: <20902913.EfDdHjke4D@PointedEars.de> References: <9c826658-ec67-4f21-badf-7159371fb499n@googlegroups.com> <05dbc574-1b62-4eef-9ae8-76e877ae0172n@googlegroups.com> <12673259.uLZWGnKmhe@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: gwaiyur.mb-net.net; posting-host="190.227.197.178.dynamic.wless.zhbmb00p-cgnat.res.cust.swisscom.ch:178.197.227.190"; logging-data="7872"; mail-complaints-to="abuse@open-news-network.org" User-Agent: KNode/4.14.10 Cancel-Lock: sha1:p4ghh7XS3jkgjgy/x2qOw4wdh5g= X-User-ID: U2FsdGVkX18Q2VdROBCNEK9Sw4VjiC/cJE3wA7uvMU7RENDhqYOGjQ== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. Thomas 'PointedEars' Lahn kirjutas pühapäev, 27. detsember 2020 kl > 22:35:51 UTC+2: [Attribution *line*, NOT attribution novel.] >> >> >> 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) 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'); 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: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.