source: Dev/trunk/src/client/dojox/gfx/tests/svgweb/test_fx.html

Last change on this file was 483, checked in by hendrikvanantwerpen, 11 years ago

Added Dojo 1.9.3 release.

File size: 3.0 KB
Line 
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<!-- SVGWEB { -->
10<meta name="svg.render.forceflash" content="true"/>
11<script src="svgweb/src/svg.js" data-path="svgweb/src"></script>
12<script src="../../../../dojo/dojo.js" data-dojo-config="isDebug:true,forceGfxRenderer:'svg'" type="text/javascript"></script>
13<!-- } -->
14<script type="text/javascript">
15dojo.require("dojox.gfx");
16dojo.require("dojox.gfx.fx");
17dojo.require("dojo.colors");
18
19var rect, text;
20
21var makeShapes = function(){
22        var surface = dojox.gfx.createSurface("test", 500, 500);
23        /* SVGWEB { */
24        surface.whenLoaded(function() {
25        rect = surface.createRect({x: 100, y: 100, width: 300, height: 300}).
26                setFill("yellow").setStroke({
27                        color: "green",
28                        width: 5,
29                        join: "round"
30                });
31        text = surface.createText({x: 250, y: 250, text: "Hello!", align: "middle"})
32                .setFill("black").setFont({family: "serif", size: "10pt"});
33        });
34        /* } */
35};
36
37dojo.addOnLoad(makeShapes);
38
39var animateStroke = function(){
40        var anim = dojox.gfx.fx.animateStroke({
41                duration:       5000,
42                shape:          rect,
43                color:          {start: "green", end: "red"},
44                width:          {start: 5, end: 15},
45                join:           {values: ["bevel", "round"]}
46        });
47        dojo.byId("stroke").disabled = "disabled";
48        dojo.connect(anim, "onEnd", function(){ dojo.byId("stroke").disabled = ""; });
49        anim.play();
50};
51
52var animateFill = function(){
53        var anim = dojox.gfx.fx.animateFill({
54                duration:       5000,
55                shape:          rect,
56                color:          {start: "yellow", end: "blue"}
57        });
58        dojo.byId("fill").disabled = "disabled";
59        dojo.connect(anim, "onEnd", function(){ dojo.byId("fill").disabled = ""; });
60        anim.play();
61};
62
63var animateFont = function(){
64        var anim = dojox.gfx.fx.animateFont({
65                duration:       5000,
66                shape:          text,
67                variant:        {values: ["normal", "small-caps"]},
68                size:           {start: 10, end: 50, units: "pt"}
69        });
70        dojo.byId("font").disabled = "disabled";
71        dojo.connect(anim, "onEnd", function(){ dojo.byId("font").disabled = ""; });
72        anim.play();
73};
74
75var animateTransform = function(){
76        var anim = dojox.gfx.fx.animateTransform({
77                duration:       5000,
78                shape:          text,
79                transform:      [
80                        {name: "rotategAt", start: [0, 250, 250], end: [360, 350, 350]},
81                        {name: "translate", start: [0, 0], end: [100, 100]}
82                ]
83        });
84        dojo.byId("transform").disabled = "disabled";
85        dojo.connect(anim, "onEnd", function(){ dojo.byId("transform").disabled = ""; });
86        anim.play();
87};
88</script>
89</head>
90<body>
91<h1>Testing animation</h1>
92<p>
93        <button id="stroke" onclick="animateStroke();">Stroke</button>
94        &nbsp;
95        <button id="fill" onclick="animateFill();">Fill</button>
96        &nbsp;
97        <button id="font" onclick="animateFont();">Font</button>
98        &nbsp;
99        <button id="transform" onclick="animateTransform();">Transform</button>
100</p>
101<div id="test" style="width: 500px; height: 500px;"></div>
102<p>That's all Folks!</p>
103</body>
104</html>
Note: See TracBrowser for help on using the repository browser.