summaryrefslogtreecommitdiff
path: root/includes/js/dojox/gfx/tests/test_linearGradient.html
blob: f18021a817684b460941e729dc8ce90520998630 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
<head>
<title>Dojo Unified 2D Graphics</title>
<style type="text/css">
	@import "../../../dojo/resources/dojo.css";
	@import "../../../dijit/tests/css/dijitTests.css";
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--
The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
<script type="text/javascript" src="Silverlight.js"></script>
-->
<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
<script type="text/javascript" src="../../../dojo/_base/Color.js"></script>
<script type="text/javascript" src="../_base.js"></script>
<script type="text/javascript" src="../shape.js"></script>
<script type="text/javascript" src="../path.js"></script>
<script type="text/javascript" src="../arc.js"></script>
<!--<script type="text/javascript" src="../vml.js"></script>-->
<!--<script type="text/javascript" src="../svg.js"></script>-->
<!--<script type="text/javascript" src="../canvas.js"></script>-->
<!--<script type="text/javascript" src="../silverlight.js"></script>-->
<script type="text/javascript">
dojo.require("dojox.gfx");
dojo.require("dojo.colors");

makeShapes = function(){
	var lg1 = {
		type: "linear",
		x1: 0, y1: 0,
		x2: 300, y2: 0,
		colors: [
			{ offset: 0,   color: [0, 0, 0, 0] },
			{ offset: 0.1, color: "#000000" },
			{ offset: 0.2, color: "red" },
			{ offset: 0.3, color: "rgb(0,255,0)" },
			{ offset: 0.4, color: "blue" },
			{ offset: 0.5, color: "#ff0" },
			{ offset: 0.6, color: [128] },
			{ offset: 0.7, color: [128, 128, 64] },
			{ offset: 1,   color: [0, 255, 0, 0] }
		]
	};
	var lg2 = {
		type: "linear",
		x1: 0, y1: 0,
		x2: 300, y2: 0,
		colors: [
			{ offset: 0.2, color: "red" },
			{ offset: 0.3, color: "yellow" }
		]
	};
	var surface = dojox.gfx.createSurface(dojo.byId("grad"), 300, 300);
	var group = surface.createGroup();
	var rect1 = surface.createRect({ 
		width:  300,
		height: 100
	});
	rect1.setFill(lg1);
	var rect2 = surface.createRect({ 
		y: 150,
		width:  300,
		height: 100
	});
	rect2.setFill(lg2);
	group.add(rect1);
	group.add(rect2);
};
dojo.addOnLoad(makeShapes);
</script>
<style>
v:group { text-align: left; }
#grad { width: 300px; height: 300px; }
</style>
</head>
<body>
<h1>dojox.gfx Linear Gradient test</h1>
<div id="grad"></div>
</body>
</html>