ghost sine wave
@author
void setup(){
size(640, 480);
background(0);
}
void draw(){
noStroke();
fill(0, 40);
rect(0, 0,width, height);
stroke(0, 255, 0);
strokeWeight(3);
noFill();
beginShape();
for(int w = 0; w <= width; w++){
vertex(w, map(sin(w * 0.1 + frameCount * 0.1), -1, 1, -120, 120) + height / 2);
}
endShape();
float ampOffset = map(mouseX - pmouseX, -200, 200, 30, -30);
float angOffset = map(mouseY - pmouseY, -200, 200, -30, 30);
beginShape();
for(int w = 0; w <= width; w++){
vertex(w, map(sin((w + angOffset) * 0.1 + frameCount * 0.1), -1, 1, -120, 120) + height / 2 + ampOffset);
}
endShape();
}