helloworld.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Equation Editor</title>
  6. </head>
  7. <body style="font-size:30px; font-family: Arial;">
  8. <!-- Page -->
  9. <div style="position:absolute; width:100%; height:100%; top:0px; left:0px; overflow: hidden;">
  10. <!-- Canvas -->
  11. <canvas id="canvas" style="position:absolute; width:100%; height:100%; top:0px; left:0px;"></canvas>
  12. </div>
  13. <!-- Code -->
  14. <script type="text/javascript" src="../build/escher.js"></script>
  15. <script type="text/javascript">
  16. // Canvas
  17. var canvas = document.getElementById("canvas");
  18. canvas.width = window.innerWidth;
  19. canvas.height = window.innerHeight;
  20. // Resize canvas on window resize
  21. window.onresize = function()
  22. {
  23. canvas.width = window.innerWidth;
  24. canvas.height = window.innerHeight;
  25. };
  26. var group = new Escher.Object2D();
  27. var text = new Escher.Text();
  28. text.position.set(0, -100);
  29. text.text = "Hello World!"
  30. group.add(text);
  31. var box = new Escher.Box();
  32. box.position.set(-100, 0);
  33. group.add(box);
  34. var circle = new Escher.Circle();
  35. circle.position.set(100, 0);
  36. circle.radius = 50;
  37. group.add(circle);
  38. var viewport = new Escher.Viewport(canvas);
  39. var renderer = new Escher.Renderer(canvas);
  40. renderer.createRenderLoop(group, viewport);
  41. </script>
  42. </body>
  43. </html>