sakura
クリックすると押し花みたいな桜が咲くよ
//クリックすると押し花みたいな桜が咲くよ
package {
import flash.display.*;
import flash.events.MouseEvent;
import caurina.transitions.Tweener;
[SWF(width = "465", height = "465", frameRate = "24", backgroundColor = "#FFFFFF")]
public class sakura extends Sprite {
public function sakura():void {
stage.addEventListener(MouseEvent.CLICK,mouseClickHandler);
}
private function mouseClickHandler(e:MouseEvent):void {
var sp:Shape = new Shape;
addChild(sp);
sp.x = mouseX;
sp.y = mouseY;
sp.scaleX = sp.scaleY = 0;
sp.rotation = Math.random() * 180;
var rn:Number = 1- Math.random() * 0.3;
Tweener.addTween(sp,{scaleX:rn, scaleY:rn, time:0.8, transition:"easeOutExpo"});
}
}
}
import flash.display.*;
class Shape extends Sprite {
public function Shape():void {
var rc:Number = 0xFBD2D2 + Math.floor(Math.random() * 30);
for (var i:int = 0; i < 5; i++) {
var myShape:Sprite = new Sprite;
myShape.graphics.lineStyle(15, rc, 1.0, false, LineScaleMode.NORMAL, CapsStyle.ROUND, JointStyle.MITER);
myShape.graphics.moveTo(-6, -24);
myShape.graphics.lineTo(0, -10);
myShape.graphics.lineTo(6, -24);
myShape.rotation = i * 72;
myShape.alpha = 0.7;
addChild(myShape);
}
}
}