/** * 25-Line ActionScript Contest Entry * * Project: upclose * Author: Ben Morrison * Date: 11-27-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=1150, height=710, backgroundColor=0x000000, frameRate=24)] stage.scaleMode = StageScaleMode.NO_SCALE; // 25 lines begins here! // If you're testing this in the IDE, disable keyboard shortcuts for the full effect <--------------------------------------------------------- var s = addChild(new Sprite()); s.transform.matrix3D = new Matrix3D(Vector.([1,0,0,0,0,1,0,0,0,0,1,0,575,355,-150,1])); // a great abbreviated way to set x,y,z var tf = new TextField(); // stupid TextField and its lack of constructor arguments... I had the next few lines done in a shadier manner, but I had the lines to spare and didn't want to break any rules tf.autoSize = TextFieldAutoSize.LEFT; tf.defaultTextFormat = new TextFormat("_sans", 22); tf.text = "upclose: an experiment with virtual lcd pixels. [esc] changes color mode, click toggles 3d, keyboard edits text"; tf.type = TextFieldType.INPUT; tf.setSelection(tf.text.length, tf.text.length); var v = [24, [40,24], 45, 0, true, 2]; // misc vars addEventListener(Event.ENTER_FRAME, function(evt){ stage.focus = tf; // i want the textfield to keep focus after you click... there might be a better way... probably would still take 1 line anyway. s.graphics.clear(); tf.textColor = [0xFFFFFF, 0x000000, 0x000000][v[3]]; var bmp = new BitmapData(v[1][0],v[1][1],false,[0xFFFFFFFF, 0xFF000000 + 0x010000 * (int((Math.sin(getTimer()/1200)+1)*128)) + 0x000100 * (int((Math.sin(getTimer()/1000)+1)*128)) + 0x000001 * (int((Math.sin(getTimer()/800)+1)*128)), 0xFFFFFFFF][v[3]] ); if (v[3] == 0) bmp.perlinNoise(v[1][0],v[1][1],1,10,false,false,7,false,[new Point(-getTimer()/50,0)]); bmp.draw(tf, new Matrix(1,0,0,1,v[2] = v[2] < -tf.width + 8 ? bmp.width : v[2] - v[5],-3)); for (var i=0; i