paper.js/examples/Node.js/SVGImport.js

23 lines
522 B
JavaScript
Raw Normal View History

var paper = require('paper'),
path = require('path'),
fs = require('fs');
2013-05-09 05:39:19 -04:00
paper.setup(new paper.Canvas(300, 600));
with (paper) {
fs.readFile('./in.svg', { encoding: 'utf8' }, function (err, data) {
if (err)
throw err;
project.importSVG(data);
paper.view.exportFrames({
amount: 1,
directory: __dirname,
onComplete: function() {
console.log('Done exporting.');
},
onProgress: function(event) {
console.log(event.percentage + '% complete, frame took: ' + event.delta);
}
});
});
}