Login With Github

RoughJS API: Config

When instantiating RoughCanvas, you can, optionally, pass in a configuration object. The object can have any of these properties:

async

An optional boolean property to create an async version of Canvas/Generator. This is required when running RoughJS in a worker.

Default value is false.

const rc = rough.canvas(canvas, { async: true });
(async () => {
  await rc.rectangle(10, 10, 100, 100);
  await rc.rectangle(10, 120, 100, 100, {fill: 'red'});
})();

options

An options object that sets the default values for all shapes in the RoughCanvas instance.

noWorker

If workly has been loaded in the window, RoughJS will delegate most of the processing to a worker thread. If noWorker is set to true, it will not do that. For more about using web workers, read here.

worklyURL

When using web workers as described here, RoughJS will try to load the workly library from the CDN (https://cdn.jsdelivr.net/gh/pshihn/workly/dist/workly.min.js). If you want to provide a different source for workly, set the worklyURL property to that url.

0 Comment

temp