Nasal Piercings Manipulator
Wondering what’s next for npm?Check out our public roadmap! »

drawpointTypeScript icon, indicating that this package has built-in type declarations

2.1.8 • Public • Published

Draw Points

A simple library to abstract drawing on HTML canvases by using points and operations on points.

Interactive demo


Get by cloning the repository, or npm install drawpoint.

building from source

npm install
npm run build


npm install
npm test [optional seed]

The test outputs the seed it's using at the top, which you can pass back into npm test [seed] to replicate behaviour.

include (browser)

Include dist/drawpoint.js in a script tag and use drawpoint as the global namespace containing all the functions.

    <meta charset="UTF-8">
    <script src="./drawpoint.js"></script>
<canvas id="cv" width="600" height="600" style="border:solid black 2px"></canvas>
// can use just as a global variable in the browser
// use dp as a shorthand
const dp = drawpoint;

include (CommonJS)

Only useful is the source is ultimately used in the browser since that's the only place where canvas and rendering contexts exist. This would be the case if the code's passed through browserify or webpack, for example.

const dp = require('drawpoint');

include (ES2015 module)

import * as dp from 'drawpoint';


npm i drawpoint

DownloadsWeekly Downloads






Unpacked Size

233 kB

Total Files


Last publish


  • avatar