Thanks for the link. A bit advanced for me at the moment to try to de-syfer at this low level I think.
Here's an example:
Code:
float i;
void setup(){
size(100,100);
}
void draw(){
background(100);
noFill();
bezier(0, 100, 90, 90, 10, 10, 100, 0);
fill(255);
int steps = 100;
i = mouseX;
float t = i / float(steps);
float x = bezierPoint(0, 90, 10, 100, t);
float y = bezierPoint(100, 90, 10, 0, t);
ellipse(x, y, 5, 5);
}
if you scrub mouse in x you can see that the ellipse doesn't stay locked in x with mouseX. This is because the ellipse x,y is derived based on the length of the curve and not the distance traveled in mouseX. I was hoping for a secret formular for this
I looked at a few bezier curve examples on the net and they all seem to derive the point on the curve by halving linear interpolation between control and anchor points http://www.cubic.org/docs/bezier.htm
Is there another way to plot a bezier curve than this? I imagine there's a common approach because ever animation package has this ability. Just wondering if anyone knows what this approach is?
Thanks again,
Dan.