For this week's force assignment I was inspired by one of the most serious ecological disasters that happened in my country this week.
A tremendous amount of tar has washed up on much of Israel's Mediterranean coastline, one of the worst environmental disasters in history.
I volunteered to help clear the pollutant from the beaches so the inspiration for this week was a very hands-on one. I started by uploading an image of the beach and apply the force on top of it:
But I wasn’t too happy with how it turned out so then I decided to try and create the ocean myself. I used noise() for the movement of the waves.
let noiseZ = frameCount * 0.01;
let noiseY = 0;
let noiseX = 0;
let n = noise(noiseX, noiseY, noiseZ);
noiseX += dx;
noiseY += dy;
I define the edges but not to the height, to make it look like it continues with the movement of the waves in the ocean.
this.checkEdges = function() {
if (this.pos.x < 0) {
this.pos.x = 0;
this.vel.x *= -1;
}
if (this.pos.x > width) {
this.pos.x = width;
this.vel.x *= -1;
}
if (this.pos.y < 0) {
this.pos.y = 0;
this.vel.y *= -1;
this.vel.y *= -1;
}
There is still a scope of improvement and I’ll keep working on it.
Comentários