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

forked from: ColorfulRotation2

/**
 * 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/bOIL
 */

// forked from Maeda_addevent's ColorfulRotation2
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=0xFFFFFF,frameRate=60)]

    public class FB00003 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;
        public var _mySprite:mySprite;
        public var myCol:int=0;

        public function FB00003() {
            var ushiro:Sprite = new Sprite();
            ushiro.graphics.beginFill(0xFFFFFF,1);
            ushiro.graphics.drawRect(0,0,sw,sh);
            ushiro.graphics.endFill();
            addChild(ushiro);
            

            stage.addEventListener(MouseEvent.MOUSE_MOVE,xDown1,false,0,false);
        }

        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.lineStyle((Math.random()*3+1),int(color),2,false,"none");
        this.graphics.drawRect(0,0,(Math.random()*20+5),Math.random()*20+5);
        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.rotationX += 0.5;
        this.rotationY += 0.5;
        this.rotation +=1;
        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;
        }
    }
}