Beautifl - Flash Gallery

Thumbnail : 初めてのFrocessing-2:curveVertex
初めてのFrocessing-2:curveVertex
szktkhr 2009-08-28 All rights reserved

再生するにはFlash Playerが必要です。デスクトップのブラウザでご覧ください。

package {
	import flash.display.Sprite;
	import flash.events.Event;
	[SWF(width="465", height="465", frameRate="60", backgroundColor="#000000")]
	public class Sketch extends Sprite {
		
		private var lines:Array;
		
		public function Sketch() {
			addEventListener(Event.ADDED_TO_STAGE, initialize);
		}
		
		private function initialize(e:Event):void {
			lines = [];
			addEventListener(Event.ENTER_FRAME, draw);
			var l:Line = new Line(stage.stageWidth);
			lines.push(l);
			addChild(l);
		}
		
		public function draw(e:Event):void {
			var prevLine:Line = lines[lines.length - 1];
			var l:Line = new Line(stage.stageWidth);
			lines.push(l);
			addChild(l);
			l.y = stage.stageHeight / 2;
			l.start();
		}
		
		public function remove(l:Line):void {
			removeChild(l);
		}
		
	}
}
import caurina.transitions.Tweener;
import frocessing.display.F5MovieClip2D;
class Line extends F5MovieClip2D {
	public function Line(w:Number) {
	}
	public function start():void {
		noFill();
		stroke(255);
		beginShape();
		curveVertex(0, 0);
		curveVertex(0, 0);
		curveVertex(mouseX, mouseY);
		curveVertex(stage.stageWidth, 0);
		curveVertex(stage.stageWidth, 0);
		endShape();
		
		Tweener.addTween(this, {y: stage.stageHeight * 1.5, time: 2, transition: 'easeInCubic', onComplete: function():void {
			var p:Sketch = parent as Sketch;
			p.remove(this);
		}});
	}
}