ハートがヒラヒラ。
/**
* Copyright seino ( http://wonderfl.net/user/seino )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/7bJy
*/
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
import flash.geom.Point;
[SWF(width="400", height="400", backgroundColor="#000000", frameRate="50")]
public class menyHearts extends Sprite {
public function menyHearts() {
transform.perspectiveProjection.projectionCenter = new Point(stage.width/2, stage.height/2);
addEventListener(Event.ENTER_FRAME,addHeart);
}
private function addHeart(e:Event):void{
var rX:int = Math.random() * stage.stageWidth;
var rY:int = Math.random() * stage.stageHeight;
var heart:MovieClip = new drawHeart(0xff6699
,rX
,rY);
heart.x = rX;
heart.y = rY;
heart.z = 0;
stage.addChild(heart);
}
}
}
import flash.display.MovieClip;
import flash.geom.Vector3D;
import flash.events.Event;
class drawHeart extends MovieClip{
public function drawHeart(color:int
,x:int
,y:int):void{
graphics.beginFill(color);
graphics.lineStyle(3.0, 0x000000);//線の太さで気持ち程度に滑らかさを演出(`・ω・´)
graphics.moveTo(x, y);
//右と左分けて作ったものをくっつけてひとつにした方がいいんじゃないか。ハートだし。
//ここから左半分
graphics.curveTo(x-5 , y-25, x-30, y-30);
graphics.curveTo(x-50, y-25, x-50, y);
graphics.curveTo(x-50, y+10, x, y+65);
//ここから右半分
graphics.curveTo(x+50, y+10, x+50, y);
graphics.curveTo(x+50, y-25, x+30, y-30);
graphics.curveTo(x+5 , y-25, x, y);
graphics.endFill();
var rnd:Number = Math.random();
scaleX = rnd;
scaleY = rnd;
addEventListener(Event.ENTER_FRAME,fadeOut);
}
private function fadeOut(e:Event):void{
alpha -= 0.05;
//一つずつクルクルしたいけど回転軸がおかしなところにあるっぽい。
transform.matrix3D.prependRotation(3,Vector3D.Z_AXIS);
y += 5;
if (alpha <= 0){
stage.removeChild(this);
}
}
}