npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

we-render

v1.0.2

Published

canvas render engine

Downloads

8

Readme

weRender

Simple, light-weight, Canvas library for 2D rendering

Features

  • Chain API

  • Drawing actions reusable

  • Same methods as CanvasRenderingContext2D

Install

npm install we-render

Usage

  • ES6 module

import { WeCanvas, WeStage } from 'we-render'

const child = new WeCanvas()
  .setSize(100, 100)
  .scale(2, 2)
  .fillStyle("red") // different here
  .fillRect(0, 0, 10, 10)

const stage = new WeStage()

stage.addChid(child)
stage.update()
  • In browser

<script type="text/javascript" src="../dist/weRender.min.js"></script>
<script type="text/javascript">
var WeStage = weRender.WeStage;
var WeCanvas = weRender.WeCanvas;

var stage = new WeStage(document.querySelector("#canvas"));
stage.setSize(500, 500);
stage.setStyle("500px", "500px");

var yellowCircle = new WeCanvas({
  width: 100,
  height: 100,
})
.beginPath()
.fillStyle("yellow")
.arc(50, 50, 50, 0, 2 * Math.PI)
.fill()

stage.addChild(yellowCircle);
stage.update();
</script>

Examples

See examples: npm run static

  • simple

  • clone

  • reuse actions

  • composite

  • zoom

Scripts

Usefull Scripts, see:

  • scripts

API reference

Modules

Classes

weRender

weRender: Simple Canvas library for easy usage

WeCanvas

WeCanvas: Easy canvas api for using, support useing chain

  • Directly use CanvasRenderingContext2D methods
  • Property of CanvasRenderingContext2D here is method
  • Won't really drawing Canvas until run draw()

Kind: global class

new WeCanvas(options)

create a WeCanvas instance

| Param | Type | Description | | --- | --- | --- | | options | Object | option settions for instance |

weCanvas.setSize(width, height)

set canvas size

Kind: instance method of WeCanvas

| Param | Type | Description | | --- | --- | --- | | width | Number | canvas width | | height | Number | canvas height |

weCanvas.setStyle(width, height)

set canvas style, only width and height

Kind: instance method of WeCanvas

| Param | Type | Description | | --- | --- | --- | | width | String | canvas style width | | height | String | canvas style height |

weCanvas.setCoordinate(x, y)

set coordinate of stage

Kind: instance method of WeCanvas

| Param | Type | Default | Description | | --- | --- | --- | --- | | x | Number | 0 | horizontal axis | | y | Number | 0 | vertical axis |

weCanvas.setScale(scale)

set init scale

Kind: instance method of WeCanvas

| Param | Type | Description | | --- | --- | --- | | scale | Number | scale ratio |

weCanvas.clear()

clear canvas

Kind: instance method of WeCanvas

weCanvas.getActions()

get actions for context drawing

Kind: instance method of WeCanvas

weCanvas.setActions(actions)

set actions

Kind: instance method of WeCanvas

| Param | Type | Description | | --- | --- | --- | | actions | Array | actions for context drawing |

weCanvas.draw()

run actions, draw canvas

Kind: instance method of WeCanvas

weCanvas.cache(ifCache)

set cache, default: true

Kind: instance method of WeCanvas

| Param | Type | Default | Description | | --- | --- | --- | --- | | ifCache | Boolean | true | if set cache |

WeStage

WeStage: Canvas manager for WeCanvas

Kind: global class

new WeStage(canvas, options)

create a WeStage instance

| Param | Type | Description | | --- | --- | --- | | canvas | Canvas | a Canvas element related to the dom | | options | Object | stage settings |

weStage.setSize(width, height)

set stage size

Kind: instance method of WeStage

| Param | Type | Description | | --- | --- | --- | | width | Number | stage width | | height | Number | stage height |

weStage.setStyle(width, height)

set stage style

Kind: instance method of WeStage

| Param | Type | Description | | --- | --- | --- | | width | String | stage style width | | height | String | stage style height |

weStage.destory()

destrory stage

Kind: instance method of WeStage

weStage.clear()

clear canvas

Kind: instance method of WeStage

weStage.addChild(child)

add child to the stage

Kind: instance method of WeStage

| Param | Type | Description | | --- | --- | --- | | child | WeCanvas | Object | WeCanvas instance or Object cotains Canvas |

weStage.translate(x, y, reset)

translate stage, move coordinate

Kind: instance method of WeStage

| Param | Type | Default | Description | | --- | --- | --- | --- | | x | Number | 0 | offset x | | y | Number | 0 | offset y | | reset | Boolean | false | should reset after update |

weStage.update()

update stage, draw child on canvas run this method, all child canvas will draw

Kind: instance method of WeStage

docs autogenerated via jsdoc2md