Hacker News new | past | comments | ask | show | jobs | submit login
Konva – HTML5 2d canvas library for desktop and mobile applications (konvajs.github.io)
237 points by lavrton on Feb 28, 2018 | hide | past | favorite | 35 comments



We are using Konva for simple education games and the game editor at https://learnplayground.com and are mostly happy with it. It is easy to work with, the documentation is good, and so far supports all our use cases. The only drawback is some performance issues with animations on some browsers which we are not sure if we can fix by optimizing our code.

We have been using Konva for 2 years and would probably have chosen it again if we where going to start developing today


Do you also target mobile browsers by any chance and, if so, is the lib fast enough?


Yes, we target mobile browser and it works good in most. We did get a report that it is slow on Samsung browser for one user, but haven't looked more into it yet. It is also very slow on Firefox on Android, but according to some bug reports we found on Firefox it is because they have problems with performance on Android when using several layers of canvas. So as long as you don't care to much about the 0.5% who use Firefox on Android or don't need to use layers you should be good.

edit: you can go on https://learnplayground.com/games and try out free games if you want to test, but know that we are working on optimizing the game engine to work better on mobile so performance and scaling is not as good as it should be


Thanks, that's very good to know.


Been using this for a new project for a few months [0]. Cannot speak highly enough about it - Thank you Anton [1]!

[0] specifically the react package https://github.com/lavrton/react-konva

[1] https://lavrton.com/


Thank you!


You can probably have this changed to a Show HN: since you seem to be the author and are around to comment on it.


Was going to say the same but got beat. Love the ease of use in React. Thank you!


I have used Phaser to make games using HTML5 + TypeScript. It was my first attempt of doing a browser game and I found it pretty decent to use.

https://phaser.io

I don't have the final build of the project I made with it publicly visible, but an older build:

https://total-tetris.herokuapp.com

Supports mobile (touch controls) and desktop (keyboard controls). Final version has Facebook leaderboards.

I had one or two issues with Phaser which I supplied fixes for which were merged.

If I made a similar project, I would check out latest alternatives but wouldn't hesitate to use Phaser again.


Man, very well done. That’s the best html game I’ve played on mobile. Super addicting, and the radiators are an interesting twist! My strategy was to hold them until I get a heated floor.


I was actually enjoying that game until the radiator turned up! haha


Very cool


It's worth mentioning that Konva began as a fork of KineticJS:

https://github.com/ericdrowell/KineticJS/issues/1061


I'm curious: How does this compare to something like Pixi?


Cool! This is a superset of some things people misuse Literally Canvas[1] for. I look forward to pointing people toward it when they ask about these kinds of features.

[1]http://literallycanvas.com


I like the fact that there are plenty of demos!


This library is great, it's the basis of a mapping app (think D&D) some friends and I kickstarted[0] a while back.

I also posted some optimizations techniques[1] for this library to Stack Overflow.

[0] http://coneofnegativeenergy.com/hexkit/

[1] https://stackoverflow.com/questions/42729872/optimizing-konv...


Really great, thanks for the resource!

I've had ideas in the past for websites or projects where I would have wanted to use HTML5s canvas, but I haven't ever known where or how to get started. The demo here seemed very straightforward and easy to understand.

EDIT: Upon further consideration, this will actually be perfect for an upcoming project that I've been neglecting for a while due to not knowing how to do the drawing aspect. And it works with React ️


Anyone able to compare this with http://paperjs.org/? In the past I've used Paper.js and have been very happy with it. It looks like Konva has a very similar set of features.


I have used Konva to make a 2D map engine in my last job. It was a good dev experience.


This is pretty neat, does anyone have any other similar or equivalent libraries to compare this against? It's always nice to see comparisons to gauge the value of a feature or system structure. Thanks!



Can anybody explain this: "High performance event detection via color map hashing"? Any resources that explain this concept?



I'm not completely sure it's the same thing, but I remember a technique for picking using colour maps. It's described in this tutorial:

http://www.opengl-tutorial.org/miscellaneous/clicking-on-obj...


Ok thank you!


Wondering if Konva could be used for UI rendering (imagine flutter/Skia for web). And if it could be faster then DOM.


Flipboard did exactly this with react-canvas[0]. Runs nice enough even on older devices (try this[1]), but it completely decimates accessibility. Looks like there have been attempts with Konva too [2].

[0] https://github.com/Flipboard/react-canvas [1] https://flipboard.com/@flipboard/flipboard-picks-8a1uu7ngz [2] https://github.com/lavrton/react-konva


Skin is already the canvas backend for all the popular browsers, so no need to use anything.


WebGL would be faster than Canvas.


The demo on the front page says "Try to drag a star", but when I do, nothing happens.


That's odd - works well for me on my laptop both click+drag and from the touch screen.


Nitpicking: The stars don't do anything when I click them. Only when I start to drag them do I get any kind of visual feedback that something happened (they scale up)

Not sure if that's intentional. I'm on Firefox.


Can this be packaged as a single exe and can you make calls outside to like the file system or network?


This seems to be purely a visual library; I'm assuming it can be run on Electron or similar platforms, which do allow you to access the file system and network.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: