Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by lavrton on Wednesday March 19, 2025 @11:04AM
(#43412964)
It is a fork of KineticJS. SVG export isn't implemented and I don't think it will be. I, personally, see it as out of the focus of the project.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by tetris11 on Wednesday March 19, 2025 @12:05PM
(#43413820)
We used Kinetic a lot for a specific type of visual analysis we had, but when it came to creating publish-worthy figures, working with PNG screenshots was less than desirable.
Would it be so difficult to crawl over a snapshot of the object hierarchy and render to a cairo-like library?
At one point I started implementing that myself using my own object representation that I had running parallel to Kinetic's internal one, but never finished it.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by afavour on Wednesday March 19, 2025 @11:23AM
(#43413230)
SVG export feels like it would be borderline impossible. Raster graphics to vector?
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by solardev on Wednesday March 19, 2025 @12:16PM
(#43413981)
The underlying shapes are defined by geometries (so vectors) and then rasterized to canvas. So the SVG export could happen before the rasterization.
There are other libs that are native SVG though, so why even use Konva? The benefit of Canvas is that it can be a lot, LOT faster than having multiple complex SVGs. SVG is especially slow on Firefox IIRC.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by tetris11 on Wednesday March 19, 2025 @01:22PM
(#43414817)
SVG purely for image export, I'm not talking about animation features.
Konva to set the scene, SVG for final touches before you publish the image somewhere
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by solardev on Wednesday March 19, 2025 @04:48PM
(#43417173)
Seems like you could just use Figma if you want to build a static SVG for export. Konva is more for building interactive apps.
Re:Konva.js - Declarative 2D Canvas for React, Vue, and Svelte
by simonsarris on Wednesday March 19, 2025 @11:16PM
(#43419614)
I make a canvas-based diagramming library (GoJS) and implemented SVG export, and then a whole SVG renderer if you want the same scene in real-time. Generally if you're using HTML Canvas commands, you can engineer a perfect SVG equivalent. There are some really really really annoying edge cases with transforms, clipping, gradients, etc. But nothing is impossible :D
Kinetic was amazing back in it's day, but lacked SVG export. I wonder if that's built-in now