/** * 25-Line ActionScript Contest Entry * * Project: Circular logic * Author: Sakri Rosenstrom * Date: 18 November 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=380, backgroundColor=0x000044, frameRate=31)] stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! var tf:TextField=new TextField(); tf.defaultTextFormat=new TextFormat("Helvetica",120,0xFFFFFF,true);//Hopefully all machines have Helvetica... tf.text="Circular Logic Works Because "; tf.autoSize=TextFieldAutoSize.LEFT; tf.filters=[new GlowFilter(0x2222BB,.7,12,12,4,3)] var material:BitmapData=new BitmapData(tf.width+10,tf.height+10,false,0x000044); material.draw(tf,null,null,null,null,true); var vertices:Vector.=new Vector.(),t_vertices:Vector.=new Vector.(),points:Vector.=new Vector.(),triangles:Vector.=new Vector.(),uv:Vector.=new Vector.(),angle:Number=0,radius:Number=material.width/Math.PI/2,slices:uint=20,x_rot:Number=0,x_rot_speed:Number=1,y_rot:Number=-150,z_rot:Number=0,z_rot_dir:Number=-.1; for(var i:int=0;i<=slices;i++){ vertices.push(radius*Math.cos(angle*(Math.PI/180)),0,radius*Math.sin(angle*(Math.PI/180)),radius*Math.cos(angle*(Math.PI/180)),material.height,radius*Math.sin(angle*(Math.PI/180))); uv.push(1-angle/360,0,0,1-angle/360,1,0); angle+=(360/slices); if(i>1)triangles.push(i*2-4, i*2-2, i*2-3,i*2-3, i*2-2, i*2-1); } triangles.push(i*2-4, i*2-2, i*2-3,i*2-3, i*2-2, i*2-1); addEventListener("enterFrame",function handleEnterFrame(e:Event=null) { var transform_matrix:Matrix3D=new Matrix3D(); transform_matrix.prependTranslation(stage.stageWidth/2,stage.stageHeight/2-material.height/2,0);//maybe better to use a container? transform_matrix.prependRotation(y_rot--, Vector3D.Y_AXIS); transform_matrix.prependRotation((z_rot+=z_rot_dir), Vector3D.Z_AXIS); if(z_rot>20 || z_rot<-20)z_rot_dir*=-1; transform_matrix.transformVectors(vertices, t_vertices); Utils3D.projectVectors(new Matrix3D(), t_vertices, points, uv); graphics.clear(); graphics.beginBitmapFill(material); graphics.drawTriangles(points, triangles, uv, TriangleCulling.POSITIVE); }); // 25 lines ends here!