paper.js/examples/Node.js/SvgImport.js
Jürg Lehni c35814f94f Node.js: Fix bug when using paper-core.js
And improve Node.js examples. Closes #975
2016-02-15 23:59:31 +01:00

22 lines
750 B
JavaScript

// Please note: When loading paper as a normal module installed in node_modules,
// you would use this instead:
// var paper = require('paper');
var paper = require('../../dist/paper-core.js');
var path = require('path');
var fs = require('fs');
paper.setup(new paper.Size(300, 600));
paper.project.importSVG(/*'in.svg'*/'file://' + path.resolve('./in.svg'), {
onLoad: function(item) {
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);
}
});
}
});