Javascript examples for Canvas:Example
how to rotate my tween in the center of the container
<html> <head> <title>Centering with the Registration Point </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 container = new createjs.Container(); stage.addChild(container); var containerWidth = 100; var containerHeight = 100; var bounds = new createjs.Shape(); bounds.graphics.f("#eee").dr(0,0,containerWidth,containerHeight); container.addChild(bounds); var shape = new createjs.Shape(); shape.graphics.f("#f00").drawRect(0,0,50,50); container.addChild(shape); shape.x = containerWidth/2; shape.y = containerHeight/2; shape.regX = 25; shape.regY = 25; createjs.Tween.get(shape).to({rotation:360}, 3000); function tick(event) { stage.update(event); } } </script> </head> <body> <canvas id="canvas" width="800" height="600"></canvas> </body> </html>