Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2150 mathias 1
<html>
2
	<head>
3
		<title>Testing dojox.dtl using animation to change attributes</title>
4
		<script src="../../../dojo/dojo.js" djConfig="parseOnLoad: true, usePlainJson: true"></script>
5
		<script>
6
			dojo.require("dojox.dtl.widget");
7
 
8
			dojo.provide("demo");
9
 
10
			dojo.declare("demo.Animation", dojox.dtl._Widget,
11
			{
12
				buffer: 0, // Note: Sensitivity is 0 by default, but this is to emphasize we're not doing any buffering
13
				constructor: function(props, node){
14
					this.context = new dojox.dtl.Context({ x: 0, y: 0 });
15
					this.template = new dojox.dtl.HtmlTemplate(dojo.moduleUrl("dojox.dtl.demos.templates", "animation.html"));
16
				},
17
				postCreate: function(){
18
					this.render(this.template, this.context);
19
					var anim = new dojo._Animation({
20
						curve: [0, 300],
21
						rate: 10,
22
						duration: 5000,
23
						easing: dojo._defaultEasing
24
					});
25
					dojo.connect(anim, "onAnimate", this, "_reDraw");
26
					anim.play();
27
				},
28
				_reDraw: function(obj){
29
					this.context.x = obj;
30
					this.context.y = Math.sqrt(obj) * 10;
31
 
32
					dojo.style(this.blue, "left", this.context.x);
33
					dojo.style(this.blue, "top", this.context.y + 10);
34
 
35
					this.render(this.template, this.context);
36
				}
37
			});
38
 
39
			dojo.require("dojo.parser");
40
		</script>
41
	</head>
42
	<body>
43
		<div dojoType="dojox.dtl.AttachPoint">
44
			<div dojoType="demo.Animation" />
45
		</div>
46
	</body>
47
</html>