Debian Codegraph @

dojox/gfx/tests/test_fx.html

raw symbols SCIP
1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2 <head>
3 <title>Testing animation</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 <!--
11 <script type="text/javascript" src="../_base.js"></script>
12 <script type="text/javascript" src="../shape.js"></script>
13 <script type="text/javascript" src="../path.js"></script>
14 <script type="text/javascript" src="../arc.js"></script>
15 <script type="text/javascript" src="../fx.js"></script>
16 -->
17 <!--<script type="text/javascript" src="../vml.js"></script>-->
18 <!--<script type="text/javascript" src="../svg.js"></script>-->
19 <!--<script type="text/javascript" src="../canvas.js"></script>-->
20 <!--<script type="text/javascript" src="../silverlight.js"></script>-->
21
22 <script type="text/javascript">
23 dojo.require("dojox.gfx");
24 dojo.require("dojox.gfx.fx");
25 dojo.require("dojo.colors");
26
27 var rect, text;
28
29 function createSurface(){
30 var surface = dojox.gfx.createSurface("test", 500, 500);
31 surface.whenLoaded(makeShapes);
32 };
33
34 function makeShapes(surface){
35 rect = surface.createRect({x: 100, y: 100, width: 300, height: 300}).
36 setFill("yellow").setStroke({
37 color: "green",
38 width: 5,
39 join: "round"
40 });
41 text = surface.createText({x: 250, y: 250, text: "Hello!", align: "middle"})
42 .setFill("black").setFont({family: "serif", size: "10pt"});
43 };
44
45 dojo.addOnLoad(createSurface);
46
47 var animateStroke = function(){
48 var anim = dojox.gfx.fx.animateStroke({
49 duration: 5000,
50 shape: rect,
51 color: {start: "green", end: "red"},
52 width: {start: 5, end: 15},
53 join: {values: ["bevel", "round"]}
54 });
55 dojo.byId("stroke").disabled = "disabled";
56 dojo.connect(anim, "onEnd", function(){ dojo.byId("stroke").disabled = ""; });
57 anim.play();
58 };
59
60 var animateFill = function(){
61 var anim = dojox.gfx.fx.animateFill({
62 duration: 5000,
63 shape: rect,
64 color: {start: "yellow", end: "blue"}
65 });
66 dojo.byId("fill").disabled = "disabled";
67 dojo.connect(anim, "onEnd", function(){ dojo.byId("fill").disabled = ""; });
68 anim.play();
69 };
70
71 var animateFont = function(){
72 var anim = dojox.gfx.fx.animateFont({
73 duration: 5000,
74 shape: text,
75 variant: {values: ["normal", "small-caps"]},
76 size: {start: 10, end: 50, units: "pt"}
77 });
78 dojo.byId("font").disabled = "disabled";
79 dojo.connect(anim, "onEnd", function(){ dojo.byId("font").disabled = ""; });
80 anim.play();
81 };
82
83 var animateTransform = function(){
84 var anim = dojox.gfx.fx.animateTransform({
85 duration: 5000,
86 shape: text,
87 transform: [
88 {name: "rotategAt", start: [0, 250, 250], end: [360, 350, 350]},
89 {name: "translate", start: [0, 0], end: [100, 100]}
90 ]
91 });
92 dojo.byId("transform").disabled = "disabled";
93 dojo.connect(anim, "onEnd", function(){ dojo.byId("transform").disabled = ""; });
94 anim.play();
95 };
96
97 var animateMatrix = function(){
98 var customMatrix = dojox.gfx.matrix.multiply([dojox.gfx.matrix.rotategAt(-90,250,250),dojox.gfx.matrix.translate(100,100),dojox.gfx.matrix.scaleAt(2,250,250)]);
99 var anim = dojox.gfx.fx.animateTransform({
100 duration: 5000,
101 shape: text,
102 transform: [
103 {name: "matrix", start: dojox.gfx.matrix.identity, end: customMatrix}
104 ]
105 });
106 dojo.byId("matrix").disabled = "disabled";
107 dojo.connect(anim, "onEnd", function(){ dojo.byId("matrix").disabled = ""; });
108 anim.play();
109 };
110 </script>
111 </head>
112 <body>
113 <h1>Testing animation</h1>
114 <p>
115 <button id="stroke" onclick="animateStroke();">Stroke</button>
116 &nbsp;
117 <button id="fill" onclick="animateFill();">Fill</button>
118 &nbsp;
119 <button id="font" onclick="animateFont();">Font</button>
120 &nbsp;
121 <button id="transform" onclick="animateTransform();">Transform (predefined primitives)</button>
122 &nbsp;
123 <button id="matrix" onclick="animateMatrix();">Transform (raw matrix)</button>
124 </p>
125 <div id="test" style="width: 500px; height: 500px;"></div>
126 <p>That's all Folks!</p>
127 </body>
128 </html>