※現在、「wonderfl build flash online」求人コンテンツ制作に関してのアンケートを実施中です!みなさまのお力添えを頂いて、続々とアンケート結果が集まっていますが、まだまだ募集しております。ご協力のほど、どうぞよろしくお願いいたします!
wonderfl運営事務局
→アンケートページ(※ログインしてからお答えいただけるようになっています。)
hybrid-brush-02 hybrid-brush-03
- // forked from bouze's hybrid-brush-02
- // forked from bouze's hybrid-brush-01
- package
- {
- import flash.display.Graphics;
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.geom.Point;
- /**
- * ...
- * @author bouze
- */
- public class Main extends Sprite
- {
- private var drawLayer:Sprite;
- private var particles:Array = new Array();
- private var pNum:int = 10;
- private var maxDistance:Number = 20;
- private var friction:Number = 0.3;
- public function Main()
- {
- init();
- }
- private function init():void
- {
- drawLayer = new Sprite();
- addChild(drawLayer);
- initParticles();
- addEventListener(Event.ENTER_FRAME, update);
- }
- private function initParticles():void
- {
- var i:int;
- for (i = 0; i < pNum; i++)
- {
- var sp:Sprite = new Sprite();
- drawLayer.addChild( sp );
- /*
- var g:Graphics = sp.graphics;
- g.lineStyle( 1 );
- g.drawCircle( 0, 0, 4 );
- drawLayer.addChild( sp );
- */
- particles.push(
- {
- ref: sp,
- x: mouseX,
- y: mouseY,
- dx: 0,
- dy: 0
- } );
- }
- }
- private function move():void
- {
- var i:int;
- for (i = 0; i < pNum; i++)
- {
- var p:Object = particles[ i ];
- var pp:Object = particles[ i - 1 ];
- if ( i == 0 )
- {
- p.x += ( mouseX - p.x ) * friction;
- p.y += ( mouseY - p.y ) * friction;
- }
- else
- {
- p.x += ( pp.x - p.x ) * friction * ( pNum - i ) * 0.1;
- p.y += ( pp.y - p.y ) * friction * ( pNum - i ) * 0.1;
- }
- }
- }
- private function draw():void
- {
- var i:int;
- for (i = 0; i < pNum - 5; i++)
- {
- var g:Graphics = particles[ i ].ref.graphics;
- g.clear();
- g.beginFill( 0x001F1F * i );
- //g.lineStyle(1);
- g.moveTo( particles[ i ].x, particles[ i ].y );
- g.lineTo( particles[ i + 1 ].x, particles[ i + 1 ].y );
- g.lineTo( particles[ i + 2 ].x, particles[ i + 2 ].y );
- g.lineTo( particles[ i + 3 ].x, particles[ i + 3 ].y );
- g.lineTo( particles[ i + 4 ].x, particles[ i + 4 ].y );
- g.lineTo( particles[ i + 5 ].x, particles[ i + 5 ].y );
- g.lineTo( particles[ i ].x, particles[ i ].y );
- }
- g.endFill();
- }
- private function update(e:Event):void
- {
- move();
- draw();
- }
- }
- }
notice: 
