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