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.
70 lines
2.2 KiB
70 lines
2.2 KiB
2 years ago
|
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
|
||
|
<head>
|
||
|
<title>Testing setPath and curves</title>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<script type="text/javascript">djConfig = { isDebug: true };</script>
|
||
|
<script type="text/javascript" src="../../dojo.js"></script>
|
||
|
<script type="text/javascript">dojo.require("dojo.debug.console");</script>
|
||
|
<!--<script type="text/javascript" src="../../src/gfx/path.js"></script>-->
|
||
|
<!--<script type="text/javascript" src="../../src/gfx/vml.js"></script>-->
|
||
|
<!--<script type="text/javascript" src="../../src/gfx/svg.js"></script>-->
|
||
|
<script type="text/javascript">
|
||
|
dojo.require("dojo.gfx.*");
|
||
|
|
||
|
makeShapes = function(){
|
||
|
var surface = dojo.gfx.createSurface("test", 500, 500);
|
||
|
// relative path with cubic beziers
|
||
|
surface
|
||
|
.createPath("m100 100 100 0 0 100c0 50-50 50-100 0s-50-100 0-100z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: -50, dy: -50})
|
||
|
;
|
||
|
// absolute path with cubic bezier
|
||
|
surface
|
||
|
.createPath("M100 100 200 100 200 200C200 250 150 250 100 200S50 100 100 100z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: 100, dy: -50})
|
||
|
;
|
||
|
// relative path with horizontal and vertical lines, and cubic beziers
|
||
|
surface
|
||
|
.createPath("m100 100h100v100c0 50-50 50-100 0s-50-100 0-100z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: 250, dy: -50})
|
||
|
;
|
||
|
// relative path with quadratic beziers
|
||
|
surface
|
||
|
.createPath("m100 100 100 0 0 100q0 50-75-25t-25-75z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: -50, dy: 150})
|
||
|
;
|
||
|
// absolute path with quadratic bezier
|
||
|
surface
|
||
|
.createPath("M100 100 200 100 200 200Q200 250 125 175T100 100z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: 100, dy: 150})
|
||
|
;
|
||
|
// relative path with horizontal and vertical lines, and quadratic beziers
|
||
|
surface
|
||
|
.createPath("m100 100h100v100q0 50-75-25t-25-75z")
|
||
|
.setStroke({color: "blue"})
|
||
|
.setFill("#ddd")
|
||
|
.setTransform({dx: 250, dy: 150})
|
||
|
;
|
||
|
};
|
||
|
|
||
|
dojo.addOnLoad(makeShapes);
|
||
|
|
||
|
</script>
|
||
|
</head>
|
||
|
<body>
|
||
|
<p>Testing setPath and curves</p>
|
||
|
<div id="test" style="width: 500px; height: 500px;"></div>
|
||
|
<p>That's all Folks!</p>
|
||
|
</body>
|
||
|
</html>
|