Konva – Rotating a rectangle to cover another

In an earlier post I covered how to rotate a shape around any point on the canvas without using offset. In this post I’ll look at how to rotate and scale a rectangle so that it entirely covers the space it occupied before rotation. This is useful if you ever have to rotate an imageContinue reading “Konva – Rotating a rectangle to cover another”

Konva – HTML5 canvas synchronisation, part 1

Interactive whiteboard apps seem to be a popular use-case vector for the HTML5 canvas. I’m a fan of the Konva JavaScript 2d canvas library so I wondered what it would take to synchronise canvases. Design thoughts My end goal is a meeting or classroom-style whiteboard where there could be multiple users sharing and co-operating onContinue reading “Konva – HTML5 canvas synchronisation, part 1”

Konva – HTML5 Canvas text on a path

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. Measuring Text To have any chance to fitContinue reading “Konva – HTML5 Canvas text on a path”

Konva – HTML5 Canvas bottoms-up

Or, how to get the Y-axis to go bottom-up when the normal situation is for it to increase from the top-down. While we are at it, we’ll develop the bones of a plotting class. I’ll be developing my code with the use of the Konva JS canvas library which is a wrapper for the HTML5Continue reading “Konva – HTML5 Canvas bottoms-up”

Konva – using a shape’s transform to rotate points

The Konva HTML5 canvas lib has a very useful feature that can spit out the transform applied to a shape, and which we can borrow to rotate points without math. The example below illustrates the use of rect’s transform to position the corner circles. Codepen here. What is a transform ? I couldn’t find aContinue reading “Konva – using a shape’s transform to rotate points”