/** * 25-Line ActionScript Contest Entry * * Project: Baroque * Author: Thomas Kräftner * Date: 16.01.2009 * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ // 3 free lines! Alter the parameters of the following lines or remove them. // Do not substitute other code for the three lines in this section [SWF(width=600, height=600, backgroundColor=0x000000, frameRate=24)] stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.SHOW_ALL; // 25 lines begins here! var bmp:Bitmap = Bitmap(stage.addChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight,true,0x00000000)))), canvas:Sprite = new Sprite(), txt:TextField = TextField(stage.addChild(new TextField())), halt:uint = 10000, colors:Array = new Array(0x22441111,0x22FFFFFF), ar:Array, curliness:int=30; addEventListener(Event.ENTER_FRAME, step); stage.addEventListener(MouseEvent.MOUSE_WHEEL, function(e:MouseEvent):void { curliness = Math.abs(curliness + ((e.delta>0)?4:(-4)));} ); stage.addEventListener(KeyboardEvent.KEY_UP, function(e:KeyboardEvent):void { colors.unshift(Number("0x22" + Math.round(Math.random() * 0xFF).toString(16) + Math.round(Math.random() * 0xFF).toString(16) + Math.round(Math.random() * 0xFF).toString(16))) } ); stage.addEventListener(MouseEvent.MOUSE_UP, function(e:MouseEvent):void { halt = 1000; } ); function step(e:Event):void { txt.htmlText = " Curliness: " + curliness + " (Scroll to Change) || Click to Restart || Press SPACE to change colors"; bmp.bitmapData.draw(new BitmapData(txt.width = stage.stageWidth, stage.stageHeight, true, colors[0])); for (var j:int = 0; j < 4; j++) bmp.bitmapData.draw(canvas, new Matrix( 1-(Math.floor(j/2)*2), 0, 0, 1-((j%2)*2), Math.floor(j/2)*stage.stageWidth, (j%2)*stage.stageHeight), null, null, null, true); if (halt > 900) for (halt = 7; halt > 1; halt--) ar = (halt==7)?new Array():ar.concat(spread(new Array(), Math.round(Math.random() * (curliness*2)) - curliness, Math.round(Math.random() * (curliness*2)) - curliness)); canvas.graphics.clear(); for (var i:int = 0; i < 2; i++) draw(new Point(0, 0), new Point(stage.stageWidth/2-3, stage.stageHeight/2-25+i*50), 20 * Math.PI * 2 / 360, ar, Number("0x"+colors[1].toString(16).substring(2))-i*Number("0x"+colors[1].toString(16).substring(2)), Math.round(Math.random() * 2) + 3, 0.2, 0.99, halt+=3); } function spread(ar:Array,a:Number, b:Number,s:uint=40):Array { for (var i:int = 0; i < s; i++) ar.push(a + ((b - a) / s) * i); return ar; } function draw(op:Point,center:Point,winkel:Number, winkelArray:Array, color:Number=0x666666, thickness:Number=4, min:Number = 0.5, tm:Number=0.975, max:int=1000, current:int=0, c:int=0):void { while (center.x>0 && center.x0 && center.ymin && currentc+1 ? c+1 : 0]) * Math.PI * 2 / 360)); var n:Point = new Point((op.subtract(center).y/op.subtract(center).length)*thickness, -(op.subtract(center).x/op.subtract(center).length)*thickness); canvas.graphics.beginFill(color, .25 + (0 * current++)); canvas.graphics.drawPath(Vector.([1,2,2,2,2,2,2]),Vector.([op.x+on.x,op.y+on.y,op.x+on.x,op.y+on.y,op.x,op.y,op.x-on.x,op.y-on.y,center.x-n.x,center.y-n.y,center.x,center.y,center.x+n.x,center.y+n.y])); } } // 25 lines ends here!