Something from PasteBin?

by bradsedito
I love the profane code commentary here. Anyone here would be lying if they said they never felt like mouthing off four letter words while coding in as3. Haha the best is when your 1300 line as3 project won't compile because you forgot a period somewhere. Farking A.
♥0 | Line 122 | Modified 2011-08-07 09:53:17 | MIT License
play

ActionScript3 source code

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/b2W1
 */

package 
{
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.IGraphicsData;
    import flash.display.IGraphicsFill;
    import flash.display.IGraphicsPath;
    import flash.display.IGraphicsStroke;
    import flash.display.Sprite;
    import flash.display.StageScaleMode;
    import flash.display.StageQuality;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import flash.geom.Matrix;
    import flash.geom.Point;
    import flash.display.CapsStyle;
    import flash.display.JointStyle;
    import flash.utils.ByteArray;
    
    public class Main extends Sprite 
    {
        public const PI2:Number = Math.PI * 2;
        public const COUNT:int = 3+Math.random()*10;
        public const INCREMENT:Number = 1.8+Math.random();
        public const A:Point = new Point;
        public const B:Point = new Point;
        public const C:Point = new Point; 
        public const col:ColorTransform = new ColorTransform;
        public const col1:ColorTransform = new ColorTransform;
        public const col2:ColorTransform = new ColorTransform;
        public const colors:Array = [ 0xff00ff00, 0xffff0000, 0xff0000ff, 0xffffff00, 0xff00ffff, 0xffff00ff, 0xffffffff ];
        public const bitdilate:Number = 1.001+Math.random()*0.04;
        public const bitscale:Number = 1 / new Array(1,2,3,4,5)[Math.round(Math.random()*4)];
        public var bit:Bitmap = null;
        public var angle:Number, ang:Number = PI2*Math.random(), rot:Number = (3 - Math.random() * 6)*Math.PI/180;
        public var radius:Number;
        public var offset:Number = 0;
        public var offset2:Number = 0;
        public var offset3:Number = 0;
        
        public var init:Boolean = false;
        
        public function Main()
        {
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.quality = StageQuality.LOW;
            x = 400;
            y = 300;
            addEventListener(Event.ENTER_FRAME, update);
            randomizecolors();
        }
        
        public function fuckup(d:BitmapData):BitmapData {
            var bytes:ByteArray = d.getPixels(d.rect);
            
            var l:uint = bytes.length;
            for (var i:uint = 0; i < 300; i++) { bytes.position = Math.min(l-8,Math.floor((Math.random() * (l - 8))/12)*12); bytes.writeByte(colors[Math.round(colors.length*Math.random())]); }
            bytes.position = 0;
            for (i = 0; i < 500; i++) { bytes.position = Math.random() * (l - 8); var byte:int = bytes.readByte(); bytes.position = Math.random() * (l - 8); bytes.writeByte(byte); }
            bytes.position = 0;
             d.setPixels(d.rect, bytes);
            return d;
        }
        
        public function update(e:Event):void
        {
            if (bit == null) {
                bit = new Bitmap(new BitmapData(Math.min(800,stage.stageWidth) * bitscale, Math.min(600,stage.stageHeight) * bitscale, true, 0xFF000000));
                bit.x = x - bit.width/bitscale / 2; bit.y = y - bit.height/bitscale / 2;
                bit.scaleX = 1/bitscale; bit.scaleY = 1/bitscale;
                stage.addChildAt(bit, 0);
                }
            var b:Bitmap = new Bitmap(fuckup(bit.bitmapData.clone()));
            var m:Matrix = new Matrix(bitdilate, 0, 0, bitdilate, b.width * (1 - bitdilate) / 2, b.height * (1 - bitdilate) / 2);
            bit.bitmapData.draw(b, m, new ColorTransform(0.9, 0.9, 0.9, 1));
            bit.bitmapData.draw(this, new Matrix(scaleX * bitscale, 0, 0, scaleY * bitscale, bit.width / 2 * bitscale, bit.height / 2 * bitscale), new ColorTransform(0.95, 0.95, 0.95, 0.7, 0, 0, 0, 0));
            
            graphics.clear();
            graphics.moveTo(0, 0);
            scaleX = 1 + Math.cos(offset)/3;
            scaleY = 1 + Math.sin(offset)/3;
            //Radius start
            radius = Math.min(stage.stageWidth, stage.stageHeight) / 6;
            
            //Use this to fuckin mess with colors
            if (Math.random() < 0.1) randomizecolors();
            col.redOffset = col1.redOffset;
            col.greenOffset = col1.greenOffset;
            col.blueOffset = col1.blueOffset;
            
            ang += rot;
            
            for (angle = +ang; angle < PI2+ang; angle += PI2 / COUNT)
            {
                //Get 2 points based on the fuckin angle and mess with them a bit
                A.x = Math.cos(angle + offset) * radius;
                A.y = Math.sin(angle - offset) * radius;
                B.x = A.x/4+Math.cos(angle + offset2) * radius;
                B.y = A.y/4+Math.sin(angle - offset2) * radius;
                C.x = B.x/4+Math.cos(angle + offset3) * radius;
                C.y = B.y/4+Math.sin(angle - offset3) * radius;
                
                //Draw some Lines/Splines/Diagrams
                graphics.lineStyle(0, col.color, 0.4);//, false, "normal", CapsStyle.SQUARE, JointStyle.BEVEL );
                graphics.curveTo(B.x, -B.y, A.x, A.y); graphics.lineTo(-A.x, -A.y);
                graphics.curveTo( -C.x, C.y, B.x, B.y); graphics.lineTo(-B.x, -B.y);
                graphics.curveTo( -A.x, A.y, C.x, C.y); graphics.lineTo( -C.x, -C.y);
                graphics.lineTo(A.x, A.y); graphics.lineTo(B.x, B.y); graphics.lineTo(C.x, C.y);
                
                //Adjust radius for cool effect
                radius -= INCREMENT * Math.abs(Math.atan(angle));
                
                col.alphaMultiplier = Lerp(col.alphaMultiplier, col2.alphaMultiplier, 2 / COUNT);
                col.redOffset = Lerp(col.redOffset, col2.redOffset, 2/COUNT);
                col.greenOffset = Lerp(col.greenOffset, col2.greenOffset, 2 / COUNT);
                col.blueOffset = Lerp(col.blueOffset, col2.blueOffset, 2/COUNT);
            }
            
            graphics.lineStyle(20, col.color, 0.05);
            graphics.drawCircle(0, 0, Math.sqrt(A.x * A.x + A.y * A.y));
            graphics.drawCircle(0, 0, Math.sqrt(B.x * B.x + B.y * B.y));
            graphics.drawCircle(0, 0, Math.sqrt(C.x * C.x + C.y * C.y));
            
            //Adjust the fuckin offsets
            offset = ((offset + Math.PI * 0.01) + PI2) % PI2;
            offset2 = ((offset2 + Math.PI * 0.005) + PI2) % PI2;
            offset3 = ((offset3 + Math.PI * 0.0025) + PI2) % PI2;
            
        }
        public function randomizecolors():void {
            col1.redOffset = Math.random() * 128;
            col1.greenOffset = Math.random() * 128;
            col1.blueOffset = Math.random() * 128;
            col1.alphaMultiplier = 0.4;
            
            col2.redOffset = Math.random() * 256;
            col2.greenOffset = 128+Math.random() * 128;
            col2.blueOffset = Math.random() * 128;
        }
        public function Lerp(a:Number,b:Number,m:Number):Number
        {
            return (a + (b - a) * m);
        }
    }
}