We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › how o make a shape follow a curved path
Pages: 1 2 
how o make a shape follow a curved path? (Read 1527 times)
Re: how o make a shape follow a curved path?
Reply #15 - Nov 23rd, 2008, 12:47am
 
I just wanted to reply by saying that this code has helped me immensely, although for much different purposes.
Re: how o make a shape follow a curved path?
Reply #16 - Nov 25th, 2008, 12:13am
 
New question, related to this code:

How would one make it so the green dot "swings" from one extreme of the disc to the other?

Edit: So far, this is the closest I can get:

Code:

if (going) {
//speed of movement
pos += 0.1; // Change value to modify speed
circleX = int(centerX + 0.5 * diskW * sin(pos));
circleY = int(centerY + 0.5 * diskH * cos(pos));
if(circleX > centerX + 20) {
pos = pos + accel;
accel = accel - .005;
}
if(circleX < centerX + 20) {
pos = pos - accel;
accel = accel + .005;
}
}


It swings to the right exactly as intended, but upon changing direction it tweaks out.
Pages: 1 2