fork download
  1. (function (global) {
  2.  
  3. // NameSpace
  4. global.Crazy = Crazy || {};
  5. var Crazy = global.Crazy;
  6. var ctx = null;
  7.  
  8. // The Labratory
  9. Crazy.Lab = function () {
  10.  
  11. var canvas = document.createElement('canvas');
  12.  
  13. document.body.appendChild(canvas);
  14. document.body.style.padding = 0;
  15. document.body.style.margin = 0;
  16.  
  17. this.width = canvas.width = window.innerWidth;
  18. this.height = canvas.height = window.innerHeight;
  19.  
  20.  
  21. canvas.style.display = "block";
  22. canvas.style.backgroundColor = "#f6f6f6";
  23.  
  24. ctx = this.ctx = canvas.getContext("2d");
  25.  
  26.  
  27. }
  28.  
  29. Crazy.Lab.prototype.constructor = Crazy.Lab;
  30.  
  31.  
  32. Crazy.Point = function (x, y) {
  33. this.x = x;
  34. this.y = y;
  35.  
  36. ctx.beginPath();
  37. ctx.arc(x, y, 2, 0, Math.PI * 2, false);
  38. ctx.fill();
  39. }
  40.  
  41. Crazy.Point.prototype.constructor = Crazy.Point;
  42.  
  43. Crazy.Line = function (p1, p2) {
  44. ctx.beginPath();
  45. ctx.moveTo(p2.x, p2.y);
  46. ctx.lineTo(p1.x, p1.y);
  47. ctx.stroke();
  48. }
  49.  
  50. Crazy.Line.prototype.constructor = Crazy.Line;
  51. return Crazy;
  52.  
  53. })(this);
Success #stdin #stdout 0.02s 30152KB
stdin
Standard input is empty
stdout
Standard output is empty