一本毛
初wonderfl!!
コードきたないぜ!!
/**
* Copyright kidaipu ( http://wonderfl.net/user/kidaipu )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/u8aC
*/
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
//初wonderfl!!
//コードきたないぜ!!
public class ke extends Sprite
{
private var hairNum:int = 1;
private var hair:Array = new Array(hairNum*100);
private var randness:Number = 0.1;
private var originX:Number = 232.5; //髪の起点
private var originY:Number = 465;
private var opendeg:int = 300;
private var corn:int = 20;
//swfのステータス
[SWF(width = "465", height = "465", frameRate = "60", backgroundColor = "0x000000")]
public function ke()
{
addEventListener(Event.ENTER_FRAME,onEnterFrameHandler);
}
private function onEnterFrameHandler(e:Event):void
{
var i:int;
for(i=0;i<hairNum;i++)
{
var hai:Sprite = new Sprite();
hai.graphics.lineStyle(3,0x000000);
hai.graphics.moveTo(originX-i/hairNum ,originY); //根本
//極座標変換
var alpha:Number = Math.PI/2 - mouseX*opendeg*(hair.length/2 - i)*Math.PI/(stage.width * hair.length * 180);
var r:Number = Math.abs(mouseY-originY);
var scale:Number =randness*mouseX*opendeg/(stage.width*hair.length);
//ベジェ
var j:int;
for(j=0;j<corn;j+=2)
{
hai.graphics.curveTo(((r*Math.cos(alpha)+originX-i/hairNum)*j + (originX - i/hairNum)*(corn - j) )/corn + scale*j*(Math.random()*50-25), ((originY-r*Math.sin(alpha))*j + originY*(corn - j) )/corn + scale*j*(Math.random()*50-25),( (r*Math.cos(alpha)+originX-i/hairNum)*(j+1) + (originX - i/hairNum)*(corn - (j+1) ) )/corn + scale*(j+1)*(Math.random()*50-25) , ( (originY-r*Math.sin(alpha))*(j+1) + originY * (corn - (j+1)) )/corn + scale*(j+1)*(Math.random()*50-25) );
}
hai.graphics.endFill();
addChild(hai);
swapChildrenAt(0,1);
removeChildAt(1);
}
}
}
}