In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

ColorfulRotation

Get Adobe Flash player
by Maeda_addevent 14 Jul 2012
/**
 * Copyright Maeda_addevent ( http://wonderfl.net/user/Maeda_addevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/4X9D
 */

package {
    import flash.display.Sprite;
    import flash.display.Graphics;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.geom.ColorTransform;
    import frocessing.color.ColorHSV;
    [SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]

    public class FB00001 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;
        public var myColor:ColorTransform = new ColorTransform();
        public var viewBmd:BitmapData=new BitmapData(sw,sh,false,0x000000);
        public var viewBmp:Bitmap=new Bitmap(viewBmd);
        public var _mySprite:mySprite;
        public var myCol:int=0;

        public function FB00001() {

            addChild(viewBmp);
            var tmpBmd:BitmapData;
            myColor.redMultiplier=0.999;
            myColor.greenMultiplier=0.999;
            myColor.blueMultiplier=0.999;
            addEventListener(Event.ENTER_FRAME,xDraw);
            stage.addEventListener(MouseEvent.MOUSE_MOVE,xDown1,false,0,false);
        }
        public function xDraw(e:Event):void {
            viewBmd.draw(stage,null,myColor);
        }
        public function xDown1(e:MouseEvent):void {
            var _color:ColorHSV=new ColorHSV(myCol+=5,0.9);
            _mySprite = new mySprite(int(_color));
            _mySprite.x=mouseX;
            _mySprite.y=mouseY;
            addChild(_mySprite);
        }
    }
}

import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.BlurFilter;
import frocessing.color.ColorHSV;

class mySprite extends Sprite {

    public var radius:Number;
    public var max:Number = 3;
    public var min:Number = -3;
    public var speedX:Number=(Math.random()* (max - min + 1) + min)
    public var speedY:Number=(Math.random()* (max - min + 1) + min)
    public var myColor2:ColorTransform = new ColorTransform();

    public function mySprite(color:uint) {

        this.graphics.beginFill(int(color),1.5);
        this.graphics.drawRect(0,0,1,15);
        this.graphics.endFill();
        this.addEventListener(Event.ENTER_FRAME,xEnter2,false,0,true);

    }

    public function xEnter2(e:Event):void {
        radius=this.width/2;
        this.x+=speedX;
        this.y+=speedY;
        this.rotation += 10;
        this.rotationX += 5;
        this.alpha -= 0.001;
        
        if (this.alpha < 0) {
            stage.removeChild(this);
        }

        if (this.x+radius>stage.stageWidth) {
            this.x=stage.stageWidth-radius;
            speedX=- speedX;
        }
        if (this.x-radius<0) {
            this.x=radius;
            speedX=- speedX;
        }
        if (this.y+radius>stage.stageHeight) {
            this.y=stage.stageHeight-radius;
            speedY=- speedY;
        }
        if (this.y-radius<0) {
            this.y=radius;
            speedY=- speedY;
        }
    }
}