Alpha nodejs support

This commit is contained in:
Лаврёнов Антон
2014-02-27 19:55:39 +08:00
parent 5f931cf250
commit c8ddd27c2c
13 changed files with 1767 additions and 1442 deletions

29
nodejs-demo.js Normal file
View File

@@ -0,0 +1,29 @@
var fs = require('fs'),
Kinetic = require('./kinetic');
var layer = new Kinetic.Layer({
width : 200,
height : 200
});
var rect = new Kinetic.Rect({
width : 100,
height : 100,
x : 50,
y : 50,
fill : 'green'
});
var text = new Kinetic.Text({
text : 'Generated inside node js',
x : 20,
y : 20,
fill : 'black'
});
layer.add(rect).add(text);
layer.draw();
var stream = layer.createPNGStream();
var file = fs.createWriteStream(__dirname + '/helloworld.png');
stream.on('data', function(chunk) {
file.write(chunk);
});