xxxxxxxxxx
148
let slider;
let horlines;
let frame_num = 700;
let horizon_prop = 0.4
let r;
let content = 'DEARFLAMINGO1 EN TAUTCHILE1';
let yStart = 0;
let d, g;
function setup() {
cnv = createCanvas(windowWidth, windowHeight);
cnv.mouseMoved(changeSize);
slider = createSlider(0, 255, random(255));
slider.position(0,0,'fixed');
r = random(255);
textAlign(CENTER, CENTER);
textSize(15);
horlines = random(10,30);
d = 10;
g = 10;
}
function draw() {
background(0);
for (i=0; i<horlines; i++) {
let spread =3;
let basepoint = (i*spread*windowWidth/horlines)-(spread*windowWidth/4);
line(windowWidth*0.5,0,basepoint,windowHeight);
}
// vloer
strokeWeight(d)
stroke(r, mouseX/2, mouseY/2);
let hor = windowHeight * horizon_prop;
for (i = 0; i<horlines; i++) {
let prop = (((frameCount + (i*frame_num/horlines))% frame_num)/frame_num)**4 ;
let v = hor + (prop * (windowHeight - hor));
line(0, v, windowWidth, v)
}
// lucht
stroke(40, 10, 112);
fill(40, 10, 112);
rect(0,0,windowWidth,horizon_prop*windowHeight);
//tekst 1
for (let y = yStart; y < height/3; y += 90) {
fill(255, mouseY/2, mouseX/2);
text(content, width / 6, y);
}
yStart--;
//tekst 2
for (let y = yStart; y < height/3; y += 90) {
fill(255, mouseY/2, mouseX/2);
text(content, width / 6 *5, y);
}
yStart--;
//zon
stroke(236, slider.value(), 20);
fill(236, slider.value(), 20);
ellipse(windowWidth/2,0.6*horizon_prop*windowHeight,200,200)
// bergen
stroke(r, mouseX/2, mouseY/2);
fill(36, 10, 92);
randomSeed(4);
let mount_top = 0.4*horizon_prop*windowHeight;
let mount_height = 0.6*horizon_prop*windowHeight;
beginShape(); //TRIANGLE_STRIP
vertex(0, windowHeight*horizon_prop);
vertex(0, mount_top);
for (i=0; i<horlines; i++) {
vertex(windowWidth * i/horlines,
mount_top+random(mount_height));
}
vertex(windowWidth, mount_top);
vertex(windowWidth, windowHeight*horizon_prop);
vertex(0, windowHeight*horizon_prop);
endShape();
stroke(r, mouseX/2, mouseY/2);
fill(26, 7, 66);
mount_top = 0.6*horizon_prop*windowHeight;
mount_height = 0.4*horizon_prop*windowHeight;
beginShape();
vertex(0, windowHeight*horizon_prop);
vertex(0, mount_top);
for (i=0; i<horlines; i++) {
vertex(windowWidth * i/horlines,
mount_top+random(mount_height));
}
vertex(windowWidth, mount_top);
vertex(windowWidth, windowHeight*horizon_prop);
vertex(0, windowHeight*horizon_prop);
endShape();
stroke(r, mouseX/2, mouseY/2);
fill(21, 5, 52);
mount_top = 0.8*horizon_prop*windowHeight;
mount_height = 0.2*horizon_prop*windowHeight;
beginShape(); //TRIANGLE_STRIP
vertex(0, windowHeight*horizon_prop);
vertex(0, mount_top);
for (i=0; i<horlines; i++) {
vertex(windowWidth * i/horlines,
mount_top+random(mount_height));
}
vertex(windowWidth, mount_top);
vertex(windowWidth, windowHeight*horizon_prop);
vertex(0, windowHeight*horizon_prop);
endShape();
stroke(r, mouseX/2, mouseY/2);
fill(0);
mount_top = 0.9*horizon_prop*windowHeight;
mount_height = 0.1*horizon_prop*windowHeight;
beginShape(); //TRIANGLE_STRIP
vertex(0, windowHeight*horizon_prop);
vertex(0, mount_top);
for (i=0; i<horlines; i++) {
vertex(windowWidth * i/horlines,
mount_top+random(mount_height));
}
vertex(windowWidth, mount_top);
vertex(windowWidth, windowHeight*horizon_prop);
vertex(0, windowHeight*horizon_prop);
endShape();
}
function mouseMoved() {
g = g + 5;
if (g > 255) {
g = 0;
}
}
function changeSize() {
d = d + 0.03;
if (d > 7.5) {
d = 1;
}
}