mouse drag and drop using createjs - Javascript Canvas

Javascript examples for Canvas:Mouse

Description

mouse drag and drop using createjs

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Quick MouseEvent sample</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.createjs.com/createjs-2015.05.21.combined.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*  ww  w .j  av a 2  s  . c o  m*/
var stage = new createjs.Stage("canvas");
createjs.Ticker.on("tick", tick);
var shape = new createjs.Shape();
shape.graphics.f("#f00").dc(0,0,50);
shape.set({x:100,y:100});
stage.addChild(shape);
shape.on("pressmove", function(event) {
    shape.x = event.stageX;
    shape.y = event.stageY;
});
function tick(event) {
    stage.update(event);
}
    }

      </script> 
   </head> 
   <body> 
      <canvas id="canvas" width="800" height="600"></canvas>  
   </body>
</html>

Related Tutorials