svg-to-canvas-2d
A command line tool for converting static SVGs into Javascript canvas API calls.
Last updated 10 months ago by theseanl .
MIT · Original npm · Tarball · package.json
$ cnpm install svg-to-canvas-2d 
SYNC missed versions from official npm registry.

svg-to-canvas-2d

A command line tool for converting static SVGs into Javascript canvas API calls.

Based on svg2canvas by samsha, which is again based on canvg. It uses puppeteer and applies does code formatting to automate and batch process conversion. Note that sometimes a bug of canvg leads to canvas API calls with defects, so users should manually verify that the resulting JS draws what is expected.

Installation

yarn install

Usage

svg-to-canvas [glob_of_svg_files[,glob2[, ...]]] [output_file_name]
// output.js - one line per file, ./path/to/svg_file.svg is converted to:
var svg_file = function (ctx) { ctx.save(); /* ... */ ctx.restore(); };

Current Tags

  • 1.1.0                                ...           latest (10 months ago)

1 Versions

  • 1.1.0                                ...           10 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |