Skip to content
Advertisement

Tag: path-2d

How to position Path2D SVG element in canvas?

I’m drawing a path2D SVG shape on canvas. The problem is that the moveTo function does not seem to work when using SVG data. The problem is illustrated in this codepen. https://codepen.io/grasmachien/pen/rNaJeBN Is there a way to move the path without moving the canvas? Answer Use the transform to move the path Using CanvasRenderingContext2D.translate or using CanvasRenderingContext2D.setTransform or using CanvasRenderingContext2D.transform

Advertisement