xxxxxxxxxx
62
// PixelFields
// Created by Mirette Dahab
// January 6th, 2025
// Independent work
// Genuary day 6
// Prompt: Make a landscape using only primitive shapes.
let t = 0; // time variable for Perlin noise
function setup() {
createCanvas(400, 400);
blendMode(DIFFERENCE)
}
function draw() {
background(111, 98, 208);
//grid
noStroke();
for(i= 0;i<width+20;i+=17){
for(j = 0;j<height-90;j+=12){
fill(112, random(200,255), 219);
ellipse(i,j,random(8,10));
}
}
//orange hills
strokeWeight(14);
stroke(255, 151, 112);
//horizontal offsets using Perlin noise
let hill1X = width / 8 + map(noise(t), 0, 1, -100, 180);
let hill2X = width / 2 + map(noise(t + 0.2), 0, 1, -120, 120);
let hill3X = width * 7 / 8 + map(noise(t + 0.4), 0, 1, -210, 80);
line(hill1X, 97, hill1X - 150, 297);
line(hill1X, 97, hill1X + 150, 297);
line(hill2X, 134, hill2X - 100, 297);
line(hill2X, 134, hill2X + 100, 297);
line(hill3X, 110, hill3X - 130, 297);
line(hill3X, 110, hill3X + 130, 297);
//sun
fill(52, 9, 20);
noStroke();
ellipse(width * 7 / 8 - 20, 50, 90);
//pink ground
fill(255, 92, 192);
strokeWeight(0.2);
stroke(255);
for (let i = 1; i < 1000; i += 20) {
rect(i, 300, random(12, 15), 200);
}
// Increment time variable
t += 0.01;
}