Including createjs library

  • There's a user macro included in this instance of confluence system so you can press "{" and then Createjs to add it
  • If you want to use it in your own project, you need to know the location of your createjs library and add the code:
    • <script src="https://code.createjs.com/easeljs-0.8.0.min.js"></script>
alternate content  
Source code
	<script>
		function init() {
			var stage = new createjs.Stage("demoCanvas"); // Get EaselJS's stage to register to the canvas named "demoCanvas", can have multiple
			var circle = new createjs.Shape(); // Create an object of "Shape" class
			circle.graphics.beginFill("red").drawCircle(0, 0, 50);  // Draw a circle using the "circle" object of "Shape" class
			circle.x = 100;
			circle.y = 100;
			stage.addChild(circle);  // Add to stage
			// stage.addChild(new createjs.Shape()).setTransform(100,100).graphics.f("red").dc(0,0,50);  works as well but messier coding, not recommended
			stage.update();  // Draw on canvas
		}
	</script>


	<canvas id="demoCanvas" width="500" height="200" style="border:1px solid #000000;">
		alternate content
	</canvas>
 
	<script>
		init();
	</script>
  • No labels