GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - canvg/canvg: JavaScript SVG parser and renderer on Canvas

BranchesTags
Open more actions menu

Latest commit

 

History

1,128 Commits
1,128 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
sandboxes
sandboxes
 
 
scripts
scripts
 
 
src
src
 
 
test
test
 
 
types/rgbcolor
types/rgbcolor
 
 
website
website
 
 
.clean-publish
.clean-publish
 
 
.commitlintrc.json
.commitlintrc.json
 
 
.czrc
.czrc
 
 
.editorconfig
.editorconfig
 
 
.eslintignore
.eslintignore
 
 
.eslintrc.json
.eslintrc.json
 
 
.gitignore
.gitignore
 
 
.nano-staged.json
.nano-staged.json
 
 
.npmrc
.npmrc
 
 
.simple-git-hooks.json
.simple-git-hooks.json
 
 
.size-limit.json
.size-limit.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
jest.config.json
jest.config.json
 
 
lgtm.yml
lgtm.yml
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
rollup.config.js
rollup.config.js
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

canvg

Logo

NPM version Dependencies status Build status Coverage status

JavaScript SVG parser and renderer on Canvas. It takes the URL to the SVG file or the text of the SVG file, parses it in JavaScript and renders the result on Canvas. It also can be used to rasterize SVG images.

Quickstart   •   Docs   •   Demo


Quickstart

Install this library using your favorite package manager:

pnpm add canvg
# or
yarn add canvg
# or
npm i canvg

Then, just import Canvg and use it:

import { Canvg } from 'canvg';

let v = null;

window.onload = async () => {
  const canvas = document.querySelector('canvas');
  const ctx = canvas.getContext('2d');

  v = await Canvg.from(ctx, './svgs/1.svg');

  // Start SVG rendering with animations and mouse handling.
  v.start();
};

window.onbeforeunload = () => {
  v.stop();
};

Description of all exports you can find in Documentation.


Docs

  • Migration to v4
  • API
  • Examples

What's implemented?

The end goal is everything from the SVG spec. The majority of the rendering and animation is working. If you would like to see a feature implemented, don't hesitate to add it to the issues list, or better is to create pull request 😎

About

JavaScript SVG parser and renderer on Canvas

canvg.js.org

Topics

canvashacktoberfestjavascriptsvg

Resources

Readme
MIT license
Activity
Custom properties

Stars

3.8k stars

Watchers

62 watching

Forks

619 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.