draw-to-canvas

draw from one canvas to another with some sanity checks

Usage no npm install needed!

<script type="module">
  import drawToCanvas from 'https://cdn.skypack.dev/draw-to-canvas';
</script>

README

draw-to-canvas

draw from one canvas to another with some sanity checks

Build Status npm version

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install draw-to-canvas --save

Usage

var moduleName = require('draw-to-canvas');

let canvas1 = document.createElement('canvas')
let canvas2 = document.createElement('canvas')

// draw from canvas1 to canvas2
drawToCanvas(canvas1, canvas2) // canvasTo

// draw from canvas1 to canvas2 at different origin
drawToCanvas(canvas1, canvas2, [20, 30]) // canvasTo

API

drawToCanvas(from:canvas/image, to:canvas/ctx, pos:arr)

Arguments

  • from - a canvas element or image
  • to - a canvas element or canvas context

License

MIT