Create a Sin wave line with Processing
- by Nintari
Hey everybody, first post here, and probably an easy one.
I've got the code from Processing's reference site:
float a = 0.0;
float inc = TWO_PI/25.0;
for(int i=0; i<100; i=i+4) {
line(i, 50, i, 50+sin(a)*40.0);
a = a + inc;
}
http://processing.org/reference/sin_.html
However, what I need is a line that follows the curve of a Sin wave, not lines representing points along the curve and ending at the 0 axis. So basically I need to draw an "S" shape with a sin wave equation.
Can someone run me through how to do this?
Thank you in advance,
-Askee