flash on 2009-4-25 alpicola forked:1favorite:0lines:39license : MIT License modified : 2009-04-25 23:32:39 Embed Tweet package { import flash.display.*; import flash.events.*; import flash.geom.*; [SWF(backgroundColor="#000000")] public class Test extends Sprite { public function Test() { var w:int = stage.stageWidth; var h:int = stage.stageHeight; var g:Graphics = graphics; var points:Vector.<Point> = new Vector.<Point>(4, true); var matrix:Matrix = new Matrix(); var commands:Vector.<int> = new Vector.<int>(4, true); var data:Vector.<Number> = new Vector.<Number>(8, true); points[0] = new Point(0, 0); points[1] = new Point(1, 0); points[2] = new Point(1, 1); points[3] = new Point(0, 1); commands[0] = 1; commands[1] = 2; commands[2] = 2; commands[3] = 2; g.beginFill(0xffffff); for (var i:int = 0; i < 300; i++) { matrix.identity(); matrix.scale(w * (Math.random() - 0.5), h * (Math.random() - 0.5)); matrix.rotate(Math.PI * Math.random()); matrix.translate(w * Math.random(), h * Math.random()); for (var j:int = 0; j < 4; j++) { var p:Point = matrix.transformPoint(points[j]); data[j*2] = p.x; data[j*2+1] = p.y; } g.drawPath(commands, data); } g.endFill(); } } } Code Fullscreen Preview Fullscreen commands data transformPoint identity rotate Point drawPath translate graphics matrix scale Matrix endFill beginFill Math.PI Vector stageWidth stageHeight Math.random Sprite sort new page view favorite forked pv344 forked from: flash on 2009-4-2.. alpicola forked:0 favorite:0lines:70 (diff:68)