sketch-canvas
TypeScript icon, indicating that this package has built-in type declarations

0.6.0 • Public • Published

Sketch-canvas

npm

Creates a canvas element

Getting started

Install from npm

npm i -S sketch-canvas

Sketch-canvas will size the canvas based on the screen dpi so that higher dpi screens remain sharp.

import {create} from 'sketch-canvas'

const canvas = create({
  width: 320,
  height: 240,
})

API

const canvas = create(opts?)
  • width? number
  • height? number

Examples

Sketch smoothes out the experience of creating and rendering on to a canvas.

import {create as createCanvas} from 'sketch-canvas'
import {create as createContext} from 'sketch-context'

const canvas = createCanvas({
  width: 640,
  height: 480,
})
const ctx = createContext({canvas})

ctx.fillStyle = '#f7ce68'
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i sketch-canvas

Weekly Downloads

3

Version

0.6.0

License

MIT

Unpacked Size

7.88 kB

Total Files

13

Last publish

Collaborators

  • mattstyles