var t = 1000
var canvas, stage, id;

function handleImageLoad(event){ 
    var live = new createjs.Bitmap("asset/live.png"); live.rotation = Math.random() * 360;
            // set bitmap x location in canvas
    live.x = canvas.width * Math.random() + 10;
            // set bitmap y location in canvas
    live.y = canvas.height * Math.random() + 10;
            // add the bitmap as a child of the stage. This means it will be drawn any time the stage is updated
            // and that its transformations will be relative to the stage coordinates:
    var hitarea = new createjs.Shape();
   hitarea.graphics.beginFill("#000000").drawCircle(45, 45, 50);
    live.hitArea=hitarea;
    stage.addChild(live);

		live.on("mousedown", function (evt) {
            var dead = new createjs.Bitmap("asset/dead.png");
            dead.rotation=evt.target.rotation;
            dead.x=live.x;dead.y=live.y;
            this.parent.addChild(dead);
            this.parent.removeChild(this);
			stage.update(evt);
		});

setTimeout(handleImageLoad,t = 0.97 * t);

}

function tick(event) {

		stage.update(event);

}

(function() {
    document.addEventListener('DOMContentLoaded', function() {

        // get a reference to the canvas we'll be working with:
        canvas = document.getElementById("testCanvas");

        // set canvas width
        canvas.width = window.innerWidth;
        // set canvas height
        canvas.height = window.innerHeight;

        // create a stage object to work with the canvas. This is the top level node in the display list:
        stage = new createjs.Stage(canvas);
		createjs.Touch.enable(stage);
        // create a new Image object
		createjs.Ticker.addEventListener("tick", tick);        
        id=setTimeout(handleImageLoad,t = 0.97 * t);
    }, false);
}());
@@ -5,16 +5,17 @@
 t = 1000
+;
 %0Avar can
@@ -66,10 +66,10 @@
 ent)
-%7B
  
+%7B
 %0A   
@@ -118,16 +118,20 @@
 e.png%22);
+%0A   
  live.ro
@@ -160,24 +160,16 @@
  * 360;%0A
-        
     // s
@@ -243,32 +243,24 @@
 dom() + 10;%0A
-        
     // set b
@@ -335,24 +335,151 @@
 ) + 10;%0A
+%0A
     
-    
+var hitarea = new createjs.Shape();%0A    hitarea.graphics.beginFill(%22#000000%22).drawCircle(45, 45, 50);%0A    live.hitArea = hitarea;%0A
     // a
@@ -575,24 +575,16 @@
 updated%0A
-        
     // a
@@ -658,139 +658,8 @@
 es:%0A
-    var hitarea = new createjs.Shape();%0A   hitarea.graphics.beginFill(%22#000000%22).drawCircle(45, 45, 50);%0A    live.hitArea=hitarea;%0A
     
@@ -681,18 +681,20 @@
 live);%0A%0A
-%09%09
+    
 live.on(
@@ -718,17 +718,16 @@
 tion
- 
 (evt) %7B%0A
     
@@ -722,20 +722,16 @@
 (evt) %7B%0A
-    
         
@@ -784,28 +784,24 @@
 %22);%0A        
-  
-  
 dead.rotatio
@@ -801,17 +801,19 @@
 rotation
-=
+ = 
 evt.targ
@@ -837,33 +837,42 @@
     
-    
 dead.x
-=
+ = 
 live.x;
+%0A        
 dead.y
-=
+ = 
 live
@@ -875,36 +875,32 @@
 live.y;%0A        
-    
 this.parent.addC
@@ -911,20 +911,16 @@
 (dead);%0A
-    
         
@@ -954,11 +954,16 @@
 s);%0A
-%09%09%09
+        
 stag
@@ -981,15 +981,21 @@
 t);%0A
-%09%09
+    
 %7D);%0A%0A
+    
 setT
@@ -1009,32 +1009,33 @@
 handleImageLoad,
+ 
 t = 0.97 * t);%0A%0A
@@ -1061,18 +1061,20 @@
 ent) %7B%0A%0A
-%09%09
+    
 stage.up
@@ -1583,18 +1583,24 @@
 anvas);%0A
-%09%09
+        
 createjs
@@ -1631,41 +1631,18 @@
     
-  // create a new Image object%0A%09%09
+%0A%0A        
 crea
@@ -1684,24 +1684,16 @@
 , tick);
-        
 %0A       
@@ -1695,17 +1695,19 @@
       id
-=
+ = 
 setTimeo
@@ -1725,16 +1725,17 @@
 ageLoad,
+ 
 t = 0.97

Beautify the code Signed-off-by: Xin Chen <admin@aadps.net>