This extension adds a suite of graphics primitives such as Planes, Fills and Strokes. These are starling display objects that are automatically triangulated for fast rendering on the GPU.
These primitives can be manipulated directly, or created on your behalf by using a familiar graphics API accessed via the Shape class.
A simple example of a Fill using Shape.graphics:
var shape:Shape = new Shape(); addChild(shape); shape.graphics.beginFill(fillColor, fillAlpha); shape.graphics.lineStyle(strokeThickness, strokeColor, strokeAlpha); shape.graphics.drawRect(top, left, right, bottom); shape.graphics.endFill();
A simple example of a Fill using the lower level primitive:
var w:Number = stage.stageWidth; var h:Number = stage.stageHeight; var waterColorTop:uint = 0x08acff; var waterColorBottom:uint = 0x0073ad; var waterColorSurface:uint = 0x61caff; var waterHeight:Number = h-100; var waterFill:Fill = new Fill(); waterFill.addVertex(0, waterHeight, waterColorTop ); waterFill.addVertex(w, waterHeight, waterColorTop ); waterFill.addVertex(w, h, waterColorBottom ); waterFill.addVertex(0, h, waterColorBottom ); addChild(waterFill);
Feel free to edit this part of the page!
Please, make it to work with atlases and subtextures!
Wheres the API reference for this Graphics Extension? ie whats in the box?
Looks great. I'm trying to find some type of api reference like adobe makes. I want to make a line the steadily grows from both sides. Any advice on this? Thanks.
skol: drawTriangles() would be awesome or please give me a hint how to implement Context3D.drawTriangles() if it's a viable alternative? http://forum.starling-framework.org/profile/skol
Does this not work with texture atlas?