Post A2somso4FBUew22Rma by joshavanier@merveilles.town
(DIR) More posts by joshavanier@merveilles.town
(DIR) Post #A2smh0gtojOzk4l1iC by joshavanier@merveilles.town
2021-01-03T12:37:45Z
0 likes, 0 repeats
#help: who is well-versed at <canvas> around here? I need help with performance optimisations hehe :>
(DIR) Post #A2smh12WWKhQp8sIPw by neauoire@merveilles.town
2021-01-03T17:17:22Z
0 likes, 0 repeats
@joshavanier I can help. The moment I started optimizing the canvas is also the moment I stoppe using it.. Do you need help with something specific?
(DIR) Post #A2smh1KxPnRdkJV19M by joshavanier@merveilles.town
2021-01-04T04:26:10Z
1 likes, 0 repeats
@neauoire haha yeah, thank you. I made a tixy.land like playground but using elements from https://hex.constraint.systems/here's what I have so far (will clean up the code later lol)https://hexy.now.sh/
(DIR) Post #A2somsH6Dl7dHmc7Oa by neauoire@merveilles.town
2021-01-04T04:29:00Z
0 likes, 0 repeats
@joshavanier ouff, yeah that's a bit too much for my computer at the moment, CPU went to 80% and the fan started instantly. Lemme see what's happening in there :>
(DIR) Post #A2somso4FBUew22Rma by joshavanier@merveilles.town
2021-01-04T04:29:43Z
0 likes, 0 repeats
@neauoire haha yeah my thinkpad turned into a teapot last night xD
(DIR) Post #A2somtPzy9popfmjuC by neauoire@merveilles.town
2021-01-04T04:35:14Z
0 likes, 0 repeats
@joshavanier Oh wow, you're drawing at each one of those lines.You could draw to a second hidden canvas and paint it only once per frame instead of all these little individual lines, you could also change the rendering mode to fast, it wouldn't be antialised but it might look better since it's just pixel thin lines.
(DIR) Post #A2somtmKd7hPwwEZiS by joshavanier@merveilles.town
2021-01-04T04:36:46Z
0 likes, 0 repeats
@neauoire wait, I can draw to a hidden canvas? o.Owhat property or function is used to transfer that canvas element's contents to the other one? I'll try it out as soon as my lunch break starts
(DIR) Post #A2somtyjszckZQ2U3U by joshavanier@merveilles.town
2021-01-04T04:37:58Z
0 likes, 0 repeats
@neauoire oh wait I think I found it; it's the getImageData and putImageData ones, right?
(DIR) Post #A2somucnU3fOZemTUe by neauoire@merveilles.town
2021-01-04T04:39:38Z
0 likes, 0 repeats
@joshavanier yes! that's the one, so instead of asking for updates on the visible canvas, it will do it in the background, you'll gain a bit of cpu there.
(DIR) Post #A2somurgahZnJpkMhU by neauoire@merveilles.town
2021-01-04T04:48:35Z
0 likes, 0 repeats
@joshavanier Better idea, you should draw the different patterns on that second canvas, and get/put the pixels directly. So you basically make a spritesheet, and pull from that spritesheet when you draw the tiles.
(DIR) Post #A2somvCxJcaeNnhLqy by neauoire@merveilles.town
2021-01-04T04:49:58Z
1 likes, 0 repeats
@joshavanier you'd instantly get rid of the push/pop stroke stuff, it would be a pretty good simple improvement.