News for hackers. Stuff that matters.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by salojoo on Wednesday March 19, 2025 @11:57AM (#43413691)
I evaluated this vs pixi and native canvas API. In the end I decided to use native API.

Konva didn't have enough performance for my use case and pixi webgl has a limit on the number of canvases on the screen at the same time

The native API is easy to use and well documented. It also performs well enough to animate charts at 60fps on modern hw for my use case. I also like that there are no libraries to update

Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by solardev on Wednesday March 19, 2025 @12:11PM (#43413894)
What was your use case? Konva is a pretty high level abstraction, more like a lightweight interactive geometry & paint engine than a graphics API. It must've taken quite a bit of work to recreate similar functionality using native APIs?
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by salojoo on Wednesday March 19, 2025 @01:31PM (#43414934)
I'm rendering charts. The native API conveniently provides the fundamentals with lines and rectangles. In addition masking and text have been very useful.

Interaction is also supported by the API with hit regions, though I've opted to do my calculations. But I agree that interaction is where Konva would probably have shined.

Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by lukan on Wednesday March 19, 2025 @02:05PM (#43415391)
"pixi webgl has a limit on the number of canvases on the screen at the same time"

But that limit is very high. What were you doing?

https://www.goodboydigital.com/pixijs/bunnymark/

Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by salojoo on Wednesday March 19, 2025 @04:01PM (#43416633)
The amount of concurrent webgl canvases on a page is limited by browsers. I believe it's somewhere between 8-20 depending on the browser.

Hopefully webgpu would lift that limit?

Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by lukan on Wednesday March 19, 2025 @04:29PM (#43416946)
I guess, the trick is to keep everything inside on stage. But why would I need more than 8 stages?

I have allmost unlimited pixi containers.

(And HTML and sometimes a ordinary canvas on top of my pixi canvas)

Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by diath on Wednesday March 19, 2025 @02:31PM (#43415664)
Those are just sprites rendered onto the same canvas, not multiple canvases.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by lukan on Wednesday March 19, 2025 @03:36PM (#43416408)
The idea with pixi is, that you have one HTML canvas. But every sprite can also be a graphics object/canvas.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by phil-martin on Wednesday March 19, 2025 @03:55PM (#43416577)
Which makes it ill-suited when you need multiple canvases. Pixijs is amazing, and I mix Pixi, Fabric and regular canvases in my application.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte by lukan on Thursday March 20, 2025 @05:05AM (#43421047)
I still would be interested in a use case for more stages. My stagecanvas is the background of the html document. And there I have many layers with different zoomlevels etc

Everything pixi goes there. And can appear exactly on the screen when and where I want. If I ever would have a use case of a second pixi layer above my html elements layer, I can do that. So I am really curious, what else one could need?