xxxxxxxxxx
var wave1
var wave2
var wave3
var seagull1
var seagull2
var drop
var gongTs = 0
var gongWs = 0
var gongSs = 0
var mX = -300
var mY = -300
let yoff = 0.0
let yoff2 = 0.0
let yoff3 = 0.0
function preload(){
wave1 = loadSound("wave1.mp3")
wave2 = loadSound("wave2.mp3")
wave3 = loadSound("wave3.mp3")
seagull1 = loadSound("seagull1.wav")
seagull2 = loadSound("seagull2.ogg")
drop = loadSound("waterDrop.wav")
}
function setup() {
createCanvas(windowWidth, windowHeight)
frameRate(30)
}
function draw() {
background(128,206,215,80)
let delta = frameCount - gongTs
let delta2 = frameCount - gongWs
let colorDelta = map(delta, 0,120,100,0,true)
stroke(128-colorDelta,206-colorDelta,167,10)
strokeWeight(3)
noFill()
for (i=0;i<random(300,700);i+=40){
ellipse(mX,mY,i+delta,i+delta)
}
push()
fill(255,40)
beginShape()
let xoff = 0
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff, yoff), 0, 1, 50+lerp(0,delta2,7), 300+lerp(0,delta2,7))
vertex(x, y)
xoff += 0.07
}
yoff += 0.01
vertex(width, height)
vertex(0, height)
endShape(CLOSE)
pop()
push()
fill(154,209,212,40)
beginShape()
let xoff2 = 0
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff2, yoff2), 0, 1, 100+lerp(0,delta2,8), 600+lerp(0,delta2,8))
vertex(x, y)
xoff2 += 0.05
}
yoff2 += 0.02
vertex(width, height)
vertex(0, height)
endShape(CLOSE)
pop()
push()
fill(1,126,167,40)
beginShape()
let xoff3 = 0
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff3, yoff3), 0, 1, 300+lerp(0,delta2,10), 800+lerp(0,delta2,10))
vertex(x, y)
xoff3 += 0.03
}
yoff3 += 0.02
vertex(width, height)
vertex(0, height)
endShape(CLOSE)
pop()
}
function keyPressed(){
if (key == "w"){
gongWs = frameCount
if (frameCount%3 == 0){
wave1.play()
} else if (frameCount%3 == 1){
wave2.play()
} else if (frameCount%3 == 2){
wave3.play()
}
}
if (key == "s"){
gongSs = frameCount
if (frameCount%2 == 0){
seagull1.play()
} else if (frameCount%2 == 1){
seagull2.play()
}
}
}
function mousePressed(){
mX = mouseX
mY = mouseY
gongTs = frameCount
drop.play()
}