From 728be483d74d8f0490ceadacbad7ee84ca46c5cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 9 May 2013 00:23:11 -0700 Subject: [PATCH] Implement SVGImport example for node, currently failing. --- examples/Node.js/SVGImport.js | 22 ++++++++++++++++++++++ examples/Node.js/in.svg | 16 ++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 examples/Node.js/SVGImport.js create mode 100644 examples/Node.js/in.svg diff --git a/examples/Node.js/SVGImport.js b/examples/Node.js/SVGImport.js new file mode 100644 index 00000000..0b2a4136 --- /dev/null +++ b/examples/Node.js/SVGImport.js @@ -0,0 +1,22 @@ +var paper = require('paper'), + path = require('path'), + fs = require('fs'); + +paper.setup(new paper.Canvas(600, 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); + } + }); + }); +} diff --git a/examples/Node.js/in.svg b/examples/Node.js/in.svg new file mode 100644 index 00000000..06aedc41 --- /dev/null +++ b/examples/Node.js/in.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + +