/** * 25-Line ActionScript Contest Entry * * Project: 25lineNebula * Author: Thomas Kräftner * Date: 28.11.2008 * * 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=50)] stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! var bmp:Bitmap = Bitmap(stage.addChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight,false,0xFF000000)))); var canvas:Sprite = Sprite(stage.addChild(new Sprite())); var spikes:Array=new Array( [new Point(300, 300),new Array(0,9,-5,9,9,2,-9,-9),0xc8daec,0xFFFFFF,1,3,1,1,0.985], [new Point(300, 100),new Array(0,9,9,9,9,9,9,-9,-9,-9,-9,-9,-9,-9),0xBBCCDD,0x000000,-1,3,1,1,0.985], [new Point(500, 100),new Array(22,22,-11,-11,5,5,-5,-5,11,11,-22,-22),0xBBCCDD,0x000000,2,4,1,1,0.97], [new Point(500, 300),new Array(0,0,0,0,0,0,0,0,0),0xBBCCDD,0x000000,1,5,1,1.5,0.98], [new Point(500, 500),new Array(25,-20,20,-25),0xBBCCDD,0x000000,1,3,1,1,0.985], [new Point(300, 500),new Array(22.5,28.5,0,0,-22.5,-22.5),0xBBCCDD,0x000000,-1,4,1,1.2,0.98], [new Point(100, 500),new Array(11.25,11.25,11.25,11.25,11.25,11.25,0,0,-11.25,-11.25,-11.25,-11.25,-11.25,-11.25),0xBBCCDD,0x000000,-1,4,1,1.2,0.98], [new Point(100, 300),new Array(25,-20,20,-25),0xBBCCDD,0x000000,1,3,1,1,0.985], [new Point(100, 100),new Array(11.25,11.25,11.25,11.25,11.25,11.25,0,0,-11.25,-11.25,-11.25,-11.25,-11.25,-11.25),0xBBCCDD,0x000000,-1,4,1,1.5,0.985]); addEventListener(Event.ENTER_FRAME, step); function step(t:Event):void { bmp.bitmapData.draw(canvas); canvas.graphics.clear(); if(!Math.round(Math.random() * 10)) bmp.bitmapData.draw(new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x01000000)); for (var i:int = 0; i < spikes.length; i++) { draw( new Point(0, 0),spikes[i][0] = Point(spikes[i][0]).add(Point.polar(.06,Math.atan2(new Point(mouseX, mouseY).subtract(spikes[i][0]).y, new Point(mouseX, mouseY).subtract(spikes[i][0]).x))),Math.atan2(new Point(mouseX, mouseY).subtract(spikes[i][0]).y, new Point(mouseX, mouseY).subtract(spikes[i][0]).x)/(Math.PI * 2 / 360),spikes[i][1],spikes[i][2],spikes[i][3],spikes[i][4],spikes[i][5],spikes[i][6],spikes[i][7],spikes[i][8]); } } function draw(op:Point,center:Point,winkel:Number, winkelArray:Array, color:Number=0x666666, mcolor:Number=0x000000, wind:Number=0, thickness:Number=4, vibra:Number=0, min:Number = 0.5, tm:Number=0.975, c:int=0):void { while (center.x>0 && center.x0 && center.ymin){ for (var i:int = 0; i < winkelArray.length; i++) { winkelArray[i]= Math.abs(winkelArray[i])<30 ? winkelArray[i]+(Math.round(Math.random() * (40+wind))-20)/1000 : Math.round(Math.random() * 60) - 30 } var on:Point = new Point((op.subtract(center).y/op.subtract(center).length)*(thickness *= tm), -(op.subtract(center).x/op.subtract(center).length)*thickness); op = center.clone(); center = center.add(Point.polar(Math.round(Math.random() * vibra)+4, (winkel+= winkelArray[c= winkelArray.length>c+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.lineStyle(); canvas.graphics.beginFill(color -= 0x010203,.07); 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])); canvas.graphics.lineStyle(0, mcolor,.1); canvas.graphics.drawPath(Vector.([1,2]),Vector.([op.x,op.y,center.x,center.y])); } } // 25 lines ends here!