In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

初めてのFrocessing-2:curveVertex

Get Adobe Flash player
by szktkhr 22 Dec 2008
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);
		}});
	}
}