Skip to content

Drawing

Module Visual.Drawing

See the link above for the drawing functions. It’s a small collection of functions to help with common drawing tasks.

import { Drawing } from 'https://unpkg.com/ixfx/dist/visual.js'
const canvasEl = document.getElementById(`myCanvas`);
const ctx = canvasEl.getContext(`2d`);
Drawing.dot(ctx, { x:10, y:10 }, { radius: 5, stroke: `red`, stroked: true });

Drawing helper

Drawing.makeHelper wraps up the provided drawing functions, associating them with a drawing context.

Eg:

import { Drawing } from 'https://unpkg.com/ixfx/dist/visual.js'
const d = Drawing.makeHelper(`#myCanvas`);
d.dot({ x:10, y:10 }, { radius: 5, stroke: `red`, stroked: true });