GithubHelp home page GithubHelp logo

alecmev / canvg Goto Github PK

View Code? Open in Web Editor NEW

This project forked from canvg/canvg

0.0 1.0 0.0 29.35 MB

JavaScript SVG parser and renderer on Canvas

Home Page: https://canvg.js.org

License: MIT License

Shell 0.07% JavaScript 40.29% TypeScript 54.10% CSS 0.42% HTML 5.12%

canvg's Introduction

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.


supported by Cube

Docs

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 😎

canvg's People

Contributors

abishekrsrikaanth avatar brettz9 avatar bz2 avatar candu avatar codedread avatar dangreen avatar dependabot-preview[bot] avatar dependabot[bot] avatar dgorbash avatar diegotremper avatar dmccabe avatar fargyriou avatar ffflabs avatar fuzhenn avatar gabelerner avatar graingert avatar hackbrettxxx avatar ilyasv avatar jpatel3 avatar kurtgokhan avatar markmaldaba avatar megaknoc avatar mnbuyskih avatar peterdavehello avatar renovate[bot] avatar rpek007 avatar rudolfhattenkofer avatar tm93112 avatar wzs1234566 avatar yar3333 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.