Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. // Please note: When loading paper as a normal module installed in node_modules,
  2. // you would use this instead:
  3. // var paper = require('paper-jsdom-canvas');
  4. var paper = require('../../dist/paper-core.js');
  5. var http = require('http');
  6. http.createServer(function(request, response) {
  7. var canvas = paper.createCanvas(800, 800);
  8. paper.setup(canvas);
  9. with(paper) {
  10. var style = {
  11. fillColor: new Color(1, 1, 0, 0.5),
  12. strokeColor: new Color(0, 0, 0),
  13. strokeWidth: 1.5
  14. };
  15. var first = new Path.Rectangle([50, 50], [150, 150]);
  16. first.style = style;
  17. var second = first.clone().translate(50, 50);
  18. second.style = style;
  19. var intersection = first.subtract(second);
  20. intersection.style = style;
  21. intersection.translate(250, 0);
  22. view.update();
  23. }
  24. var stream = canvas.pngStream();
  25. stream.on('data', function(chunk) {
  26. response.write(chunk);
  27. });
  28. stream.on('end', function() {
  29. response.end();
  30. });
  31. }).listen(3000);
  32. console.log('Server running at http://127.0.0.1:3000/');