source: main/trunk/model-sites-dev/von-sparql/js/paper/examples/Node.js/BooleanOperations.js@ 28914

Last change on this file since 28914 was 28914, checked in by ak19, 10 years ago

Supporting javascript libraries and bespoke code written by Steffan to support the von-sparql user interface

File size: 817 bytes
Line 
1var http = require('http');
2var paper = require('paper');
3
4http.createServer(function(request, response) {
5 var canvas = new paper.Canvas(800, 800);
6 paper.setup(canvas);
7 with(paper) {
8 var style = {
9 fillColor: new Color(1, 1, 0, 0.5),
10 strokeColor: new Color(0, 0, 0),
11 strokeWidth: 1.5
12 };
13
14 var first = new Path.Rectangle([50, 50], [150, 150]);
15 first.style = style;
16 var second = first.clone().translate(50, 50);
17 second.style = style;
18
19 var intersection = first.subtract(second);
20 intersection.style = style;
21 intersection.translate(250, 0);
22 view.draw();
23 }
24 var stream = canvas.createPNGStream();
25 stream.on('data', function(chunk) {
26 response.write(chunk);
27 });
28 stream.on('end', function() {
29 response.end();
30 });
31}).listen(3000);
32
33console.log('Server running at http://127.0.0.1:3000/');
Note: See TracBrowser for help on using the repository browser.