梅は咲いたか桜はまだかいな
/**
* Copyright Kay ( http://wonderfl.net/user/Kay )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/p6nf
*/
package {
import flash.display.Sprite;
import flash.events.Event;
[SWF(width=465,height=465,frameRate=30,backgroundColor=0x88aaff)]
public class Main extends Sprite {
private const SW:Number=stage.stageWidth;
private const SH:Number=stage.stageHeight;
public function Main() {
var container:Sprite = new Sprite();
container.x=SW/2;
container.y=SH/2;
container.z = 0;
addChild(container);
container.addEventListener(Event.ENTER_FRAME, xRotate);
for (var j:int = 0; j < 100; j++) {
var hana:Hana = new Hana(Math.random()*100+100);
container.addChild(hana);
hana.rotationX=Math.random()*360;
hana.rotationY=Math.random()*360;
hana.rotationZ=Math.random()*360;
}
}
public function xRotate(e:Event):void {
e.target.rotationX += 0.5;
e.target.rotationY += 0.5;
e.target.z = -30 * Math.cos(e.target.rotationY / 180 * Math.PI) - 300;
}
}
}
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.MouseEvent;
class Hanabira extends Shape {
public function Hanabira():void {
graphics.beginFill(0xffeedd);
graphics.drawCircle(0,0,4);
graphics.endFill();
}
}
class Hana extends Sprite {
private const R:Number=Math.PI*2/5;
public function Hana(nZ:Number):void {
for (var i:int = 0; i < 5; i++) {
var hanabira:Hanabira = new Hanabira();
addChild(hanabira);
hanabira.z =nZ;
}
addEventListener(MouseEvent.MOUSE_OVER, xKaika);
}
private function xKaika(e:MouseEvent) {
for (var i:int = 0; i < 5; i++) {
var hanabira:Hanabira = e.target.getChildAt(i);
hanabira.x=8*Math.cos(R*i);
hanabira.y=8*Math.sin(R*i);
}
removeEventListener(MouseEvent.MOUSE_OVER, xKaika);
}
}