Canvas
A lightweight design tool that runs in the browser
What I was exploring
Design tools for interface work tend to be heavy: large installs, updates and a lot of features you don't use day to day. I wanted to see how far a lean tool could go when it opens in a browser tab and starts drawing straight away.
Canvas was a research project at UserBin: a place to try out drawing, snapping and property editing for UI design, with keyframe controls for animation planned in from the start.
What I built
- Plain JavaScript classes and the browser's Canvas API, no frameworks or drawing libraries.
- Two stacked canvases: one for the artwork, one for selection handles and guides, so moving the cursor redraws only the overlay.
- Every shape is an object that keeps its own path commands and render queue, so the whole scene redraws with a single loop.
- A properties panel bound to the selected shape, where scrolling over a field changes the value and the shape updates as you scroll.
- Snapping rules written down before the code: snap within a threshold, release when the user drags past it, and detect matching gaps between three or more objects.
What it does
- Draw rectangles, then resize, move and rotate them with on-canvas handles.
- Change each corner radius separately and watch the shape round off live.
- A built-in colour picker with HEX, RGBA, HSLA and HSV fields.
- Rotation, size, stroke, dash and shadow values you can scrub with the mouse wheel.
- Keyframe toggles beside each animatable property, laid in for a timeline that this research build didn’t get to.
Built with JavaScript, HTML Canvas API, CSS, Express (static server), 2023.