ThorVG WebCanvas - TypeScript API for ThorVG
A high-performance TypeScript Canvas API for ThorVG, with fluent and object-oriented vector graphics rendering via WebAssembly.
import ThorVG from '@thorvg/webcanvas';// Initialize ThorVG with rendererconst TVG = await ThorVG.init({ locateFile: (path) => `/wasm/${path}`, renderer: 'gl'});// Create canvas and drawconst canvas = new TVG.Canvas('#canvas', { width: 800, height: 600 });const shape = new TVG.Shape();shape.appendRect(100, 100, 200, 150) .fill(255, 0, 0, 255);canvas.add(shape).render(); Copy
import ThorVG from '@thorvg/webcanvas';// Initialize ThorVG with rendererconst TVG = await ThorVG.init({ locateFile: (path) => `/wasm/${path}`, renderer: 'gl'});// Create canvas and drawconst canvas = new TVG.Canvas('#canvas', { width: 800, height: 600 });const shape = new TVG.Shape();shape.appendRect(100, 100, 200, 150) .fill(255, 0, 0, 255);canvas.add(shape).render();
ThorVG WebCanvas - TypeScript API for ThorVG
A high-performance TypeScript Canvas API for ThorVG, with fluent and object-oriented vector graphics rendering via WebAssembly.
Features
Example