七夕なので星っぽい何か
星型の作成方法は下記リンク先を参考にしました。ありがとうございました。
http://wonderfl.net/c/vW1O
/**
* Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pyxg
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.events.Event;
import flash.geom.ColorTransform;
import flash.ui.Mouse;
import frocessing.color.ColorHSV;
[SWF(width=465,height=465,backgroundColor=0x000000,frameRate=60)]
public class AS120707_01 extends Sprite {
public var sw:Number=stage.stageWidth;
public var sh:Number=stage.stageHeight;
public var _myCircleAlpha0:myCircleAlpha0;
public var myCol:int=0;
public function AS120707_01() {
var myBack:Sprite = new Sprite();
myBack.graphics.beginFill(0x000000,1);
myBack.graphics.drawRect(0,0,sw,sh);
myBack.graphics.endFill();
addChild(myBack);
Mouse.hide();
stage.addEventListener(Event.ENTER_FRAME,xEnter1,false,0,false);
}
public function xEnter1(e:Event):void {
var _color:ColorHSV=new ColorHSV(myCol+=1,0.9);
_myCircleAlpha0=new myCircleAlpha0(int(_color));
_myCircleAlpha0.x=mouseX;
_myCircleAlpha0.y=mouseY;
_myCircleAlpha0.rotation=-15;
addChild(_myCircleAlpha0);
}
}
}
import flash.display.Sprite;
import flash.geom.ColorTransform;
import flash.geom.Point;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.filters.BlurFilter;
import frocessing.color.ColorHSV;
class myCircleAlpha0 extends Sprite {
public var px:Number=Math.random()*465;
public var py:Number=Math.random()*465;
public var myFil:BlurFilter=new BlurFilter(2,2,2);
public var size:int=6;
public var vertex:Number=5;
public var star:Boolean=true;
public function myCircleAlpha0(color:uint) {
var points:Array = new Array();
for (var degree:Number = 0; degree < 360; degree += 360 / vertex) {
var tx:Number=0+Math.cos(degree*Math.PI/180)*size;
var ty:Number=0+Math.sin(degree*Math.PI/180)*size;
points.push(new Point(tx, ty));
if (star) {
tx = x + Math.cos((degree + 360 / vertex / 2) * Math.PI / 180) * (size / 2);
ty = y + Math.sin((degree + 360 / vertex / 2) * Math.PI / 180) * (size / 2);
points.push(new Point(tx, ty));
}
}
this.graphics.beginFill(int(color),1);
this.graphics.lineStyle(0.5, int(color));
this.graphics.moveTo(points[0].x, points[0].y);
for (var i:int = 1; i < points.length; i++) {
this.graphics.lineTo(points[i].x, points[i].y);
}
this.filters=[myFil];
this.graphics.lineTo(points[0].x, points[0].y);
this.graphics.endFill();
this.addEventListener(Event.ENTER_FRAME,xEnter2,false,0,true);
}
public function xEnter2(e:Event):void {
this.x += (px-this.x)/100;
this.y += (py-this.y)/100;
this.alpha-=0.01;
this.rotation += 5;
if (this.alpha<0) {
this.graphics.clear();
this.removeEventListener(Event.ENTER_FRAME,xEnter2);
}
}
}