void setup() { size( 400, 400 ); } void draw() { background( 0 ); stroke( 255 ); strokeWeight( 3 ); noFill(); beginShape(); for( int x = 0; x < width; ++x ) { float real_x = map( x, 0, width, -20, 20 ); float y = cos( real_x ); float real_y = map( y, -1, 1, 0, height ); vertex( x, real_y ); } endShape(); }