| 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 |
<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 10 |
<script type="text/javascript"> |
| 11 |
dojo.require("dojox.gfx"); |
| 12 |
dojo.require("dojox.gfx.shape"); |
| 13 |
dojo.require("dojox.gfx.path"); |
| 14 |
dojo.require("dojox.gfx.arc"); |
| 15 |
|
| 16 |
createSurface = function(){ |
| 17 |
var surface = dojox.gfx.createSurface("test", 500, 500); |
| 18 |
surface.whenLoaded(makeShapes); |
| 19 |
}; |
| 20 |
|
| 21 |
makeShapes = function(surface){ |
| 22 |
var m = dojox.gfx.matrix; |
| 23 |
var g1 = surface.createGroup(); |
| 24 |
var g2 = g1.createGroup(); |
| 25 |
|
| 26 |
var rx = 100, ry = 60, xRotg = -30; |
| 27 |
var startPoint = m.multiplyPoint(m.rotateg(xRotg), {x: -rx, y: 0 }); |
| 28 |
var endPoint = m.multiplyPoint(m.rotateg(xRotg), {x: 0, y: -ry}); |
| 29 |
|
| 30 |
var re1 = g1.createPath() |
| 31 |
.moveTo(startPoint) |
| 32 |
.arcTo(rx, ry, xRotg, true, false, endPoint) |
| 33 |
.setStroke({color: "red", width: 3}) |
| 34 |
; |
| 35 |
var ge1 = g1.createPath() |
| 36 |
.moveTo(re1.getLastPosition()) |
| 37 |
.arcTo(rx, ry, xRotg, false, false, startPoint) |
| 38 |
.setStroke({color: "black"}) |
| 39 |
; |
| 40 |
var re2 = g2.createPath() |
| 41 |
.moveTo(startPoint) |
| 42 |
.arcTo(rx, ry, xRotg, false, true, endPoint) |
| 43 |
.setStroke({color: "green", width: 3}) |
| 44 |
; |
| 45 |
var ge2 = g2.createPath() |
| 46 |
.moveTo(re2.getLastPosition()) |
| 47 |
.arcTo(rx, ry, xRotg, true, true, startPoint) |
| 48 |
.setStroke({color: "black"}) |
| 49 |
; |
| 50 |
|
| 51 |
g1.setTransform({dx: 200, dy: 200}); |
| 52 |
g2.setTransform({dx: 10, dy: 10}); |
| 53 |
}; |
| 54 |
|
| 55 |
dojo.addOnLoad(createSurface); |
| 56 |
|
| 57 |
</script> |
| 58 |
</head> |
| 59 |
<body> |
| 60 |
<h1>Testing arc</h1> |
| 61 |
|
| 62 |
<div id="test" style="width: 500px; height: 500px;"></div> |
| 63 |
<p>That's all Folks!</p> |
| 64 |
</body> |
| 65 |
</html> |