| 2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>dojoClass detail information</title>
|
|
|
6 |
<style type="text/css">
|
|
|
7 |
@import "../../../dojo/resources/dojo.css";
|
|
|
8 |
@import "../../../dijit/themes/tundra/tundra.css";
|
|
|
9 |
@import "../../../dijit/tests/css/dijitTests.css";
|
|
|
10 |
#node {
|
|
|
11 |
position:absolute;
|
|
|
12 |
top:100px; left:100px;
|
|
|
13 |
width:400px;
|
|
|
14 |
height:400px;
|
|
|
15 |
padding:12px;
|
|
|
16 |
-moz-border-radius:5pt;
|
|
|
17 |
overflow:hidden;
|
|
|
18 |
border:1px solid #333;
|
|
|
19 |
}
|
|
|
20 |
</style>
|
|
|
21 |
<script type="text/javascript"
|
|
|
22 |
djConfig="parseOnLoad: true"
|
|
|
23 |
src="../../../dojo/dojo.js"></script>
|
|
|
24 |
<script type="text/javascript">
|
|
|
25 |
dojo.require("dojo.parser");
|
|
|
26 |
dojo.require("dojox.fx.easing");
|
|
|
27 |
dojo.require("dojox.gfx");
|
|
|
28 |
|
|
|
29 |
var surface, shape, line, node;
|
|
|
30 |
dojo.addOnLoad(function(){
|
|
|
31 |
// dojo._Line is just a simple class to hold some numbers, and return a given point
|
|
|
32 |
// on the line as a percentage, essentially
|
|
|
33 |
var _line = new dojo._Line(20,75); // a holder for the numbers 100..300
|
|
|
34 |
console.log(_line,_line.getValue(0.5 /* Float: 0..1 */)); // should return 200
|
|
|
35 |
|
|
|
36 |
node = dojo.byId('node');
|
|
|
37 |
|
|
|
38 |
surface = dojox.gfx.createSurface(node,400,400);
|
|
|
39 |
shape = surface.createCircle({ cx: 200, cy: 200, r: 20 })
|
|
|
40 |
.setFill([0,0,255])
|
|
|
41 |
.setStroke({ color:[128,128,128], width: 1});
|
|
|
42 |
|
|
|
43 |
// so we just make a raw _Animation
|
|
|
44 |
var _anim = new dojo._Animation({
|
|
|
45 |
// the id of the shape
|
|
|
46 |
node: node,
|
|
|
47 |
// some easing options
|
|
|
48 |
easing: dojox.fx.easing.easeInOut,
|
|
|
49 |
// our radius start and end values
|
|
|
50 |
curve:_line,
|
|
|
51 |
// call transform on the shape with the values
|
|
|
52 |
onAnimate: function(){
|
|
|
53 |
shape.setShape({ r: arguments[0] });
|
|
|
54 |
},
|
|
|
55 |
duration:1200 // ms
|
|
|
56 |
// rate:100 // ms, so duration/rate iterations
|
|
|
57 |
});
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
dojo.connect(_anim,"onEnd",function(){
|
|
|
61 |
dojo.animateProperty({
|
|
|
62 |
node: node,
|
|
|
63 |
duration:1000,
|
|
|
64 |
properties: {
|
|
|
65 |
left: { end: 300, unit:"px" }
|
|
|
66 |
},
|
|
|
67 |
onEnd: function(){
|
|
|
68 |
dojo.fadeOut({ node: node, duration:3000 }).play();
|
|
|
69 |
}
|
|
|
70 |
}).play(500);
|
|
|
71 |
});
|
|
|
72 |
_anim.play(2000);
|
|
|
73 |
});
|
|
|
74 |
</script>
|
|
|
75 |
</head>
|
|
|
76 |
<body class="tundra">
|
|
|
77 |
|
|
|
78 |
<h1>animateProperty for dojox.gfx</h1>
|
|
|
79 |
<div id="node"></div>
|
|
|
80 |
|
|
|
81 |
</body>
|
|
|
82 |
</html>
|