CanvasScript3
>
Tests
> Graphics - DrawRect
Code
var stage = new Stage("canvas", 420, 500, 30); var shape; //draw a rectangle shape = new Shape(); shape.x = 20; shape.y = 20; shape.graphics.lineStyle(0); shape.graphics.beginFill(0x0000FF); shape.graphics.drawRect(0, 0, 100, 100); shape.graphics.endFill(); stage.addChild(shape); //draw a rectangle with strokes shape = new Shape(); shape.x = 140; shape.y = 20; shape.graphics.lineStyle(10, 0xFF0000); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape); //draw a rectangle with strokes and fill shape = new Shape(); shape.x = 260; shape.y = 20; shape.graphics.lineStyle(10, 0xFF0000); shape.graphics.beginFill(0x0000FF); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape); //draw a rectangle with alpha fill shape = new Shape(); shape.x = 20; shape.y = 140; shape.graphics.lineStyle(10, 0xFF0000); shape.graphics.beginFill(0x0000FF, 0.5); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape); //draw a rectangle with alpha stroke shape = new Shape(); shape.x = 140; shape.y = 140; shape.graphics.lineStyle(10, 0xFF0000, 0.5); shape.graphics.beginFill(0x0000FF); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape); //draw a rectangle with alpha fill and stroke shape = new Shape(); shape.x = 260; shape.y = 140; shape.graphics.lineStyle(10, 0xFF0000, 0.5); shape.graphics.beginFill(0x0000FF, 0.5); shape.graphics.drawRect(0, 0, 100, 100); stage.addChild(shape);
Canvas
Output