Skip to content

xmattt/generateCanvasFromPaths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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"]

Releases

No releases published

Packages

No packages published