Drag mouse up or down to change the wave shape. Press any key to save screenshot.
xxxxxxxxxx
function setup() {
createCanvas(1112, 834);
colorMode(HSB, 100);
background(255);
strokeWeight(2);
mouseX = width / 2;
mouseY = height / 4;
}
var growthVelocity = 0;
var fatness = 0;
var sineFatness = 0;
var normalFatness = 0;
var i = 0;
var yPos = 400;
var myHue = 0;
var sineAmount = 0.5;
var hu = 0;
function draw() {
background(255);
fatness = 0;
for(i = 0; i < width; i ++){
//yPos
yPos = 400 + sin((i/800) * (mouseY / 30)) * 100
//Color
myHue = (width-i)/10
stroke((hu+myHue)%100, 100, 100);
//Fatness
sineFatness = ((1+pow(i,2)/PI)*exp(-(pow(i,2)/PI)*cos(i) * (mouseX / 30) + 130.5) * 100) + 100;
normalFatness = i / 5;
fatness = sineAmount * sineFatness + (1 - sineAmount) * normalFatness;
line(i, yPos + fatness, i, yPos - fatness);
}
hu+=.5;
}
function keyPressed(){
save("img_" + month() + '-' + day() + '_' + hour() + '-' + minute() + '-' + second() + ".jpg");
}