test_arc.html 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
  2. <head>
  3. <title>Testing arc</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <style type="text/css">
  6. @import "../../../dojo/resources/dojo.css";
  7. @import "../../../dijit/tests/css/dijitTests.css";
  8. </style>
  9. <!--
  10. The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
  11. <script type="text/javascript" src="Silverlight.js"></script>
  12. -->
  13. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
  14. <script type="text/javascript" src="../_base.js"></script>
  15. <script type="text/javascript" src="../shape.js"></script>
  16. <script type="text/javascript" src="../path.js"></script>
  17. <script type="text/javascript" src="../arc.js"></script>
  18. <!--<script type="text/javascript" src="../vml.js"></script>-->
  19. <!--<script type="text/javascript" src="../svg.js"></script>-->
  20. <!--<script type="text/javascript" src="../canvas.js"></script>-->
  21. <!--<script type="text/javascript" src="../silverlight.js"></script>-->
  22. <script type="text/javascript">
  23. dojo.require("dojox.gfx");
  24. makeShapes = function(){
  25. var surface = dojox.gfx.createSurface("test", 500, 500);
  26. var m = dojox.gfx.matrix;
  27. var g1 = surface.createGroup();
  28. var g2 = g1.createGroup();
  29. var rx = 100, ry = 60, xRotg = -30;
  30. var startPoint = m.multiplyPoint(m.rotateg(xRotg), {x: -rx, y: 0 });
  31. var endPoint = m.multiplyPoint(m.rotateg(xRotg), {x: 0, y: -ry});
  32. var re1 = g1.createPath()
  33. .moveTo(startPoint)
  34. .arcTo(rx, ry, xRotg, true, false, endPoint)
  35. .setStroke({color: "red", width: 3})
  36. ;
  37. var ge1 = g1.createPath()
  38. .moveTo(re1.getLastPosition())
  39. .arcTo(rx, ry, xRotg, false, false, startPoint)
  40. .setStroke({color: "black"})
  41. ;
  42. var re2 = g2.createPath()
  43. .moveTo(startPoint)
  44. .arcTo(rx, ry, xRotg, false, true, endPoint)
  45. .setStroke({color: "green", width: 3})
  46. ;
  47. var ge2 = g2.createPath()
  48. .moveTo(re2.getLastPosition())
  49. .arcTo(rx, ry, xRotg, true, true, startPoint)
  50. .setStroke({color: "black"})
  51. ;
  52. g1.setTransform({dx: 200, dy: 200});
  53. g2.setTransform({dx: 10, dy: 10});
  54. };
  55. dojo.addOnLoad(makeShapes);
  56. </script>
  57. </head>
  58. <body>
  59. <h1>Testing arc</h1>
  60. <!--<p><button onclick="makeShapes();">Go</button></p>-->
  61. <div id="test" style="width: 500px; height: 500px;"></div>
  62. <p>That's all Folks!</p>
  63. </body>
  64. </html>