Stupid Beach Wind Thingy
you know.. those optical illusion wind things you can buy at the beach. Just needed to code it up for fun. :)
/**
* Copyright nhubben ( http://wonderfl.net/user/nhubben )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pACg
*/
package {
import flash.display.Sprite;
import flash.events.Event;
public class StupidWindThingy extends Sprite {
private var thingy:Sprite;
private var color:uint = Math.random() * 0xFFFFFF;
public function StupidWindThingy() {
thingy = new Sprite;
addChild( thingy );
thingy.x = stage.stageWidth * .5;
thingy.y = stage.stageHeight * .5;
var r:Sprite;
var total:int = 10;
var angleSegment:Number = 90 / total;
for( var i:int = 0 ; i < total ; i++ ){
r = new Sprite();
with( r.graphics ){
lineStyle( 5, color );
drawCircle( 0, 0, 10+(i*10) );
}
r.rotationY = i * angleSegment;
thingy.addChild( r );
}
addEventListener( Event.ENTER_FRAME, draw );
}
private function draw(e:Event):void{
thingy.rotationY += 5;
}
}
}