Andrew Griffin <[EMAIL PROTECTED]> on Fri, 9 Nov 2001 17:02:46 -0800
(PST) queried

> First off, I want to thank everybody who has helped me
> out here in the past.  Thank you!
> 
> Anyway, I need to move an image from point a to point
> b in a curve.  The starting point is 260,239 and the
> ending point is 600,239.  The curve needs to curve up.
> I was told to use the quadratic equation,
> y=ax^2+bx+c, but what I really need is a way to do
> this in script form and some more explanation of the
> formula.  Any help would be, as always, greatly
> appreciated!
> 
> --Andrew

Hmmm. Since you want to return to the same y-value, the job is easier.

The quadratic equation is of the form y = ax^2 + bx + c, but for your
situation, a better formula would be

y = a(x-h)^2 + k. 

(h,k) is the vertex (the lowest point). We can determine how low you want to
go, then solve for a. The resulting equation can be used in a script of the
form

repeat with i = 26 to 60
    put 10*i into x
    put a*(x - 430)^2 + k into y
    set the loc of img myimage to x,y
end repeat

Now we used 430 for the x-value of the vertex because the quadratic formula
is symmetric. The the work involved to find out the other values is not too
hard.

Choose a value for the lowest point of the vertex. Remember, going *down*
increases the y-values on screen. Suppose you want it to drop, say, down to
600.

We need to solve a*(x - 430)^2 + 600 = y for one of your points. Put
(600,239) in for (x,y), and we get

a(600 - 430)^2 + 600 = 239

so a = -361/170^2. You could do this:

put -361/170^2 into a
repeat with i = 26 to 60
    put 10*i into x
    put a*(x - 430)^2 + 600 into y
    set the loc of img myimage to x,y
end repeat

Now understand that this is going to move *quick*. By adjusting the repeat
you can make it go more slowly.

Or, you can create a graphic with the points this equation generates, and
use the move command (I think...).

I hope this helps.

Raymond



Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to