summaryrefslogtreecommitdiff
path: root/js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html
diff options
context:
space:
mode:
Diffstat (limited to 'js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html')
-rw-r--r--js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html53
1 files changed, 53 insertions, 0 deletions
diff --git a/js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html b/js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html
new file mode 100644
index 0000000..def5ecd
--- /dev/null
+++ b/js/dojo-1.7.2/dojox/dtl/demos/demo_Animation_amd.html
@@ -0,0 +1,53 @@
+<html>
+ <head>
+ <title>Testing dojox.dtl using animation to change attributes</title>
+ <script src="../../../dojo/dojo.js" data-dojo-config="parseOnLoad: true, usePlainJson: true, async:true"></script>
+ <script>
+ require(["dojo/_base/lang",
+ "dojo/_base/declare",
+ "dijit/_WidgetBase",
+ "dojox/dtl/_DomTemplated",
+ "dojo/text!./templates/animation.html",
+ "dojo/aspect",
+ "dojo/_base/fx",
+ "dojo/dom-style",
+ 'dojo/domReady!',
+ "dojo/parser",
+ "dojox/dtl/contrib/dom"], // the dtl deps used in animation.html. require it here so that it is loaded when dtl is processed.
+ function(lang, declare, _WidgetBase, _DomTemplated, template, aspect, fx, domstyle){
+
+ declare("demo.Animation", [_WidgetBase, _DomTemplated], {
+ buffer: 0, // Note: Sensitivity is 0 by default, but this is to emphasize we're not doing any buffering
+ templateString: template,
+ constructor: function(props, node){
+ this.x = 0;
+ this.y = 0;
+ },
+ postCreate: function(){
+ var anim = new fx.Animation({
+ curve: [0, 300],
+ rate: 10,
+ duration: 5000,
+ easing: fx._defaultEasing
+ });
+ aspect.after(anim, "onAnimate", lang.hitch(this, this._reDraw), true);
+ anim.play();
+ },
+ _reDraw: function(obj){
+ this.x = obj;
+ this.y = Math.sqrt(obj) * 10;
+
+ domstyle.set(this.blue, "left", this.x);
+ domstyle.set(this.blue, "top", this.y + 10);
+
+ this.render();
+ }
+ });
+ });
+
+ </script>
+ </head>
+ <body>
+ <div data-dojo-type="demo.Animation" ></div>
+ </body>
+</html>