39 posts

Tricks

Konva - HTML5 Canvas text on a path

Konva - HTML5 Canvas text on a path

VanquishedWombat

The canvas does not yet provide the same level of character manipulation and measuring functions as we might find in the Windows GDI or similar. But it does give us canvas.measureText() to measure character size. Combine that with path.getPointAtLength() and we can fit text to a path.

Konva Tricks Text Path
Members only
Konva - offscreen / ghost canvas

Konva - offscreen / ghost canvas

VanquishedWombat

I had always created Konva stages by setting the container parameter to the selector of an existing HTML DIV element. Then I needed to create an image from canvas elements as a one-off which I would then draw into the main stage. So how to do that without having a physical, in-the-DOM container DIV?

Konva Tricks Performance
Members only
Konva - how to know when the layer is drawn

Konva - how to know when the layer is drawn

VanquishedWombat

A question I see sometimes is how can we know when the layer gets redrawn. Firstly I recommend that you don't sweat about this - Konva does a perfectly good job without you interfering. But if you absolutely have to there is a way. Let's take a look...

Konva Tricks
Members only