在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:canvg/canvg开源软件地址:https://github.com/canvg/canvg开源编程语言:TypeScript 54.0%开源软件介绍:canvgJavaScript 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
QuickstartInstall this library using your favorite package manager: pnpm add canvg
# or
yarn add canvg
# or
npm i canvg Then, just import 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. DocsWhat'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 |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论