RoughJS API: RoughCanvas and RoughSVG

This page describes all you can do with RoughJS.

If you’re looking for examples, click here.
If you’re looking for how to use RoughJS in a web-worker, click here

RoughCanvas & RoughSVG

Rough.js renders to Canvas or SVG. RoughCanvas or RoughSVG provides the main interface to work with this library.

Instantiate RoughCanvas by passing in the canvas node to rough.canvas() method.

rough.canvas (canvasElement, [, config])

let roughCanvas = rough.canvas(document.getElementById('myCanvas'));

Instantiate RoughSVG by passing in the root SVG node to rough.svg() method.

rough.svg (svgRoot, [, config])

let roughSvg = rough.svg(document.getElementById('svg'));

config is optional.

Leave a Comment

Your email address will not be published.