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? LookingContinue reading “Konva – offscreen / ghost canvas”
Dev – Developing an HTML5 canvas app? Why you should use a model
Konva – rotate a shape around any point with simple math.
Shape rotation starts conceptually simple, but gets frustratingly hard quite quickly once you move away from very simple cases. This article discusses the basics and provides working code to rotate any shape around any arbitrary point on the stage. This article mentions the Konva graphics library but the math in the function can easily beContinue reading “Konva – rotate a shape around any point with simple math.”
Konva – The Transformer – a shape with a very particular set of skills
Taking a look at how the Konva.Transformer works and how it can be styled. Any app that involves drawing shapes is going to need to transform them – make them wider, taller, rotate them, etc. Typically that means you have to show which shape is the focus for the transformation, then provide some ‘handles’ atContinue reading “Konva – The Transformer – a shape with a very particular set of skills”