All Projects → weiying-shenzhen → Werender

weiying-shenzhen / Werender

Licence: mit
Simple, light-weight, Canvas library for 2D rendering

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Werender

Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (+1476.92%)
Mutual labels:  rendering, 2d-graphics, canvas
Media Watermark
GPU/CPU-based iOS Watermark Library for Image and Video Overlay
Stars: ✭ 170 (+1207.69%)
Mutual labels:  rendering, library
Raz
Modern & multiplatform game engine in C++17
Stars: ✭ 161 (+1138.46%)
Mutual labels:  rendering, library
canvas2video
canvas2video is a backend solution for creating and rendering dynamic videos.
Stars: ✭ 194 (+1392.31%)
Mutual labels:  canvas, rendering
Vrt
🔅 Ray tracing library for Vulkan API (indev)
Stars: ✭ 111 (+753.85%)
Mutual labels:  rendering, library
Hilo3d
Hilo3d, a WebGL Rendering Engine.
Stars: ✭ 123 (+846.15%)
Mutual labels:  rendering, canvas
Gg
Go Graphics - 2D rendering in Go with a simple API.
Stars: ✭ 3,162 (+24223.08%)
Mutual labels:  rendering, 2d-graphics
Pixi.js
The HTML5 Creation Engine: Create beautiful digital content with the fastest, most flexible 2D WebGL renderer.
Stars: ✭ 34,982 (+268992.31%)
Mutual labels:  rendering, canvas
Fbg
Lightweight C 2D graphics API agnostic library with parallelism support
Stars: ✭ 349 (+2584.62%)
Mutual labels:  2d-graphics, library
React Canvas
A pluggable layout and graphics system aimed at powering desktop publishing as well as storm-react-diagrams
Stars: ✭ 357 (+2646.15%)
Mutual labels:  library, canvas
Spritejs
A cross platform high-performance graphics system.
Stars: ✭ 4,712 (+36146.15%)
Mutual labels:  rendering, canvas
Pdfviewpager
Android widget that can render PDF documents stored on SD card, linked as assets, or downloaded from a remote URL.
Stars: ✭ 1,508 (+11500%)
Mutual labels:  rendering, library
D2dlib
A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
Stars: ✭ 84 (+546.15%)
Mutual labels:  rendering, library
Wechart
Create all the [ch]arts by cax or three.js - Cax 和 three.js 创造一切图[表]
Stars: ✭ 152 (+1069.23%)
Mutual labels:  rendering, canvas
Vulkan2drenderer
Easy to use 2D rendering engine using Vulkan API as backend.
Stars: ✭ 60 (+361.54%)
Mutual labels:  rendering, library
G
A powerful rendering engine which providing Canvas and SVG draw for G2 & G6
Stars: ✭ 556 (+4176.92%)
Mutual labels:  2d-graphics, canvas
Sharpmath
A small .NET math library.
Stars: ✭ 36 (+176.92%)
Mutual labels:  library, canvas
Game
Java 2D game library
Stars: ✭ 157 (+1107.69%)
Mutual labels:  2d-graphics, library
Php Svg
Vector graphics (SVG) library for PHP
Stars: ✭ 256 (+1869.23%)
Mutual labels:  rendering, library
Awesome Pixijs
My list of awesome pixi.js related parties
Stars: ✭ 489 (+3661.54%)
Mutual labels:  rendering, canvas

weRender

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

Features

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

Scripts

Usefull Scripts for improving efficiency.

SVG to Canvas

See: https://github.com/weiying-shenzhen/svgToCanvas

Examples:

See examples under directoryexamples/path

API reference

Modules

weRender

weRender: Simple Canvas library for easy usage

Classes

WeCanvas

WeCanvas: Easy canvas api for using, support useing chain

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

WeStage: Canvas manager for WeCanvas

weRender

weRender: Simple Canvas library for easy usage

WeCanvas

WeCanvas: Easy canvas api for using, support useing chain

  • Directly use CanvasRenderingContext2Dmethods
  • 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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].