Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New problem. Random colors to picture points with same distance as original...

60 views
Skip to first unread message

Kristjan Robam

unread,
Dec 27, 2020, 11:04:44 AM12/27/20
to
...and all same color areas must match same random colors.

We started to discuss this in:
https://groups.google.com/g/comp.lang.javascript/c/VvCi7Sfq9os

There is a start code. I programmed it myself. But it runs very slowly.
If someone has time to check this, I would be very thankful,
since I am very busy at the moment.

If anyone knows a place with that code, then please paste it here.

Kristjan Robam

Michael Haufe (TNO)

unread,
Dec 27, 2020, 12:03:51 PM12/27/20
to
You first. What did you do so far?

Thomas 'PointedEars' Lahn

unread,
Dec 27, 2020, 3:35:51 PM12/27/20
to
The following refers to the code referred as the “start code” in that
discussion. The OP did NOT program it themselves. (Apparently these
script-kiddies think that copy-and-pray would be the same as programming.)

<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.

--
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.
Message has been deleted

Kristjan Robam

unread,
Dec 27, 2020, 3:57:22 PM12/27/20
to
Ok you seem to be right.
Let's forget this.


Kristjan

Thomas 'PointedEars' Lahn

unread,
Dec 29, 2020, 5:00:52 PM12/29/20
to
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.

Michael Haufe (TNO)

unread,
Dec 29, 2020, 6:10:32 PM12/29/20
to
On Tuesday, December 29, 2020 at 4:00:52 PM UTC-6, Thomas 'PointedEars' Lahn wrote:

> However, I am not well-versed in Canvas (I prefer SVG), and I do not know
> how suitable those would be in this case.

And worth noting that SVG provides significant filter support:

<https://www.smashingmagazine.com/2015/05/why-the-svg-filter-is-awesome/>

Thomas 'PointedEars' Lahn

unread,
Dec 29, 2020, 7:28:34 PM12/29/20
to
Amazing. Thank you :)


\\//, Live long and prosper

Thomas 'PointedEars' Lahn

unread,
Dec 29, 2020, 7:33:48 PM12/29/20
to
This is a bit off-topic, but:

I do not buy the accessibility argument, though. For example, it is not
possible to copy the styled text in an SVG image easily (in Chromium, but
probably elsewhere, too).

Michael Haufe (TNO)

unread,
Dec 29, 2020, 10:16:43 PM12/29/20
to
On Tuesday, December 29, 2020 at 6:33:48 PM UTC-6, Thomas 'PointedEars' Lahn wrote:

> This is a bit off-topic, but:
>
> I do not buy the accessibility argument, though. For example, it is not
> possible to copy the styled text in an SVG image easily (in Chromium, but
> probably elsewhere, too).

Works for me in Brave, Firefox, and Edge. Do you have an example of one where it's not easy to copy?
The website above was using screenshots of the SVGs. Clicking "Demo" in the caption displays the actual SVG

H e

unread,
Jan 15, 2021, 12:20:51 PM1/15/21
to

Thomas 'PointedEars' Lahn

unread,
Jan 15, 2021, 6:48:29 PM1/15/21
to
Michael Haufe (TNO) wrote:

> […] Thomas 'PointedEars' Lahn wrote:
>> This is a bit off-topic, but:
>>
>> I do not buy the accessibility argument, though. For example, it is not
>> possible to copy the styled text in an SVG image easily (in Chromium, but
>> probably elsewhere, too).
>
> Works for me in Brave, Firefox, and Edge. Do you have an example of one
> where it's not easy to copy?

Try it in Chromium. It works occasionally, but it is a PITA compared to
normal text.

I have not tested yet whether screenreaders read it.
0 new messages