the two points where the parabola crosses the x plane
the y location of the vertex of the parabola
I've tried adapting the code in:
http://www.flashkit.com/movies/Scriptin ... /index.php
but that doesn't let you set the x points.
I've got the code to set the location of the 3 points, but not sure what formula/convention I can use to draw the parabola between the points and have the ends extend across the grid?
Anyone have any idea what formula I might use?
See the code below to see what I'm talking about...or you can grab the fla at http://www.brianwpiper.com/gridParabola.fla
- Code: Select all
para_mc.onEnterFrame = function() {
this.p0._y = this._parent.sliderPara_p0.slide._x*5;
this.p1._x = this._parent.sliderPara_p1.slide._x*5;
this.p2._x = this._parent.sliderPara_p2.slide._x*5;
if ((this.p1._x)<(this.p2._x)) {
this.p0._x = (this.p2._x/2)-(this.p1._x/-2);
} else {
this.p0._x = (this.p1._x/2)-(this.p2._x/-2);
}
clear();
lineStyle(1, 0, 100);
moveTo(this.p1._x+this._x, this.p1._y+this._y);
curveTo(this.p0._x+this._x, (this.p0._y*2)+this._y, this.p2._x+this._x, this.p2._y+this._y);
/**/
//text
this._parent.display_a = (this.p0._y*2)/100;
this._parent.display_p = (this.p1._x*2)/100;
this._parent.display_q = (this.p2._x*2)/100;
};
Thanks!!


