Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lemonpi/drawpoint

Abstracting drawing on a HTML canvas with points and operations on points
https://github.com/lemonpi/drawpoint

Last synced: 6 days ago
JSON representation

Abstracting drawing on a HTML canvas with points and operations on points

Awesome Lists containing this project

README

        

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

## [Interactive demo](http://johnsonzhong.me/drawpoint-demo/)

## Usage
Get by cloning the repository, or `npm install drawpoint`.

### building from source
```bash
npm install
npm run build
```

### testing
```bash
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.

```html


// 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.
```javascript
const dp = require('drawpoint');
```

### include (ES2015 module)
```javascript
import * as dp from 'drawpoint';
```