CreateJS rebote

<!DOCTYPE html>
<!–
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
–>
<html>
<head>
<title>TODO supply a title</title>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>
<script src=”https://code.createjs.com/createjs-2015.05.21.min.js”></script>
<script>
var pos = 50, circle,cuadrado,bitmap,incX=5,incY=5;

function dibujar() {
stage = new createjs.Stage(“lienzo”);
//Create a Shape DisplayObject.
circle = new createjs.Shape();

circle.graphics.beginFill(“#00FF00”).drawCircle(50, 50, 100);
//Set position of Shape instance.
circle.x = 50;
circle.y = 100;
circle.shadow=new createjs.Shadow(“#000000”, 5, 5, 10);
stage.addChild(circle);
//Update stage will render next frame
stage.update();
}
function mover() {
circle.x+=incX;
circle.y +=incY;
if (circle.x<50) incX=5;
if (circle.y<50) incY=5;
if (circle.x>650) incX=-5;
if (circle.y>450) incY=-5;

stage.update();
}

createjs.Ticker.addEventListener(“tick”, mover);

</script>
</head>
<body onload=”dibujar()”>

<canvas style=”border:solid” id=”lienzo” width=”800″ height=”600″></canvas>

</body>
</html>