/** * 25-Line ActionScript Contest Entry * * Project: Flock of Pollywogs * Author: Cay Garrido * Date: 25 nov. 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=800, height=800, backgroundColor=0xffffff, frameRate=60)] stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! var bmp:BitmapData=new BitmapData(80,80,false,0); var arr:Vector.=new Vector.(); var px1:Number=0; function newPoint(e:Event=null):void { arr.push(new Point(Math.random()*800,Math.random()*800))}; addEventListener("enterFrame",function() { graphics.clear(); var k:uint=0; if(arr.length<65 && Math.random()<.1) newPoint(); bmp.perlinNoise(40,40,3,6456,true,true,2|1,false,[new Point(px1+=0.3,0),new Point(-px1/2,0),new Point(0,0)]); for each(var c:Point in arr) { graphics.moveTo(c.x,c.y); var rgb24:uint=bmp.getPixel(c.x*.1,c.y*.1); if(rgb24>0) { c.x+=(128-(rgb24 >> 16))/5; c.y+=(128-((rgb24 ^ (rgb24 >> 16 << 16)) >> 8))/5; } c.x+=(400-c.x)/50; c.y+=(400-c.y)/50; for each(var b:Point in arr) if(b!=c && Point.distance(c,b)<30) { var ang:Number=Math.atan2(c.y-b.y,c.x-b.x); c.x+=((b.x+Math.cos(ang)*30)-c.x)/7; c.y+=((b.y+Math.sin(ang)*30)-c.y)/7; } graphics.lineStyle(4,uint("0x0000"+uint(k+=2).toString(16)),1); graphics.lineTo(c.x,c.y); } } ); stage.addEventListener("click",newPoint); // 25 lines ends here! // CLICK stage for more tadpoles :)