AS3 Kaleidoscope
/**
* Copyright LawrieCape ( http://wonderfl.net/user/LawrieCape )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/461C
*/
package
{
import flash.display.*;
import flash.events.*;
import flash.display.MovieClip;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.BlurFilter;
import flash.geom.Point;
public class Main extends Sprite
{
public var stageSin:Number = 0.1;
public var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0x000000);
public var bm:Bitmap = new Bitmap(bmd);
public function Main(){
Wonderfl.capture_delay( 60 );
stage.quality = StageQuality.LOW;
addChild(bm);
for(var i:int=1;i<=360;i++){
var circle:Shape = new Shape( );
circle.graphics.beginFill( ((0xFFFFFF*i)/360) , 1 );
circle.graphics.drawCircle( 0 , 0 , i/(i/2) );
var holder:MovieClip = new(MovieClip);
holder.x = holder. y = stage.stageWidth/2;
addChild(holder);
holder.addChild(circle)
circle.y=-10;
holder.myNum= i;
holder.addEventListener(Event.ENTER_FRAME, spinCircle);
}
addEventListener(Event.ENTER_FRAME, drawAndSin);
}
public function spinCircle(e:Event):void{
e.currentTarget.rotation+=((mouseY-200)/100)*(Math.PI*(e.currentTarget.myNum/2))/150;
e.currentTarget.alpha = Math.abs(1-(mouseX/200));
e.currentTarget.scaleX = e.currentTarget.scaleY = ((Math.PI*(e.currentTarget.myNum/2))+(Math.sin(stageSin)*350))/15;
}
public function drawAndSin(e:Event):void{
bmd.draw(this);
bmd.applyFilter(bmd, bmd.rect, new Point(0,0), new BlurFilter(2, 2, 1));
stageSin+=0.02;
}
}
}