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

Bezier Quiz Question AS Quiz # 14

Get Adobe Flash player
by shapevent 02 Feb 2010
/**
 * Copyright shapevent ( http://wonderfl.net/user/shapevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/gmhm
 */

package {
    import flash.events.*;
    import flash.display.*;
    public class FlashTest extends Sprite {
        private var canvas:BitmapData
        public function FlashTest() {
            // write as3 code here..
            canvas = new BitmapData(800,600,false, 0x000000);
            addChild(new Bitmap(canvas));

            addEventListener(Event.ENTER_FRAME, onLoop);

        }
        private function onLoop(evt:Event):void {
	canvas.fillRect(canvas.rect, 0x000000);
        for (var i:Number = 0; i<=1; i+= 0.01){
		var xp:Number = b(i, 100, mouseX, 300);
		var yp:Number = b(i, 100, mouseY, 300);
		canvas.setPixel(xp, yp, 0xFF0000);
	}
}

        private function b(t:Number, p0:Number, p1:Number, p2:Number):Number{
	    return (1 - t) * (1 - t) * p0 + 2 * (1 - t) * t * p1 + t * t * p2; ;// fill in your answer here
        }
    }
}