1.0.1 • Published 2 years ago

generate-canvas v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Generate-Canvas

Generate a JS Canvas from an Array of Layer Filepaths

Installation

Install generate-canvas

npm install generate-canvas

Usage

Initialise generate-canvas

import generateCanvas from 'generate-canvas'

Create a canvas variable with your canvas id

const canvasObj = document.getElementById($ID);

Create an array of image filepaths

paths = ["./image1.png","./image2.png", "https://www.image.com/image1.png"]

Run generate-canvas

generateCanvas(canvasObj, paths)

Options

Generate-canvas draws images at the full canvas size

To draw images of different sizes and at different points you must use the "img" identifier followed by an options string and then the image url

Options string

"x_value y_value image_width image_height"

Example

const options = `30 30 100 100`
const paths = ["img", options, "./image1.png"]