Sine curve loop

Moderators: Disciple, zlovatt

Post Reply
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

I am trying to make an expression using sine curves. I want the result to be a series of loops like a roller coaster.
Here is what I have so far:

Code: Select all

x=Math.sin(time*10)+(time*60);
y=Math.sin(time*10)*20;
[x+50,y+240]
I understand the parts for making a line go up and down across the screen, but I'm having trouble grasping what I need to make the x modulate properly to create the loops.
byronnash
Posts: 321
Joined: July 7th, 2004, 2:30 pm
Location: Charlotte, NC
Contact:

Got it. It's upside down but I can live with that. Below is the code.

Code: Select all

wave= Math.cos(time*10)*50;
forward=time*150;
x=wave + forward;
y=Math.sin(time*10)*30;
[x,y]
Post Reply