xxxxxxxxxx
let simplex
let colors=["#356C79","#356C79", "#5A94A2", "#61b2fa","#8ddcff", "#B7E3F7","#B49C51", "#b48551" , "#7AAE53"]
let chart
let lines
function preload(){
font= loadFont('FamiljenGrotesk-VariableFont_wght.ttf')
}
function setup() {
createCanvas(400, 400);
simplex= new openSimplexNoise(Date.now())
background('#f4f1de')
chart= createGraphics(280, 280)
lines= createGraphics(280, 280)
for(let x=0; x<=280; x++){
for(let y=0; y<=280; y++){
chart.fill(colorMixer(x/50, y/50, colors))
chart.noStroke()
chart.rect(x, y, 1, 1)
}
}
image(chart, 60, 60)
for(let i=0; i<5; i++){
lines.clear()
for(let x=0; x<=280; x++){
for(let y=0; y<=280; y++){
let fillIn= floor(noise(x/50, y/50) * colors.length)
lines.fill(255)
lines.noStroke()
if(fillIn==i){
lines.rect(x, y, 1, 1)
}
}
}
push()
lines.drawingContext.shadowBlur = 5;
lines.drawingContext.shadowColor = 'black';
blendMode(HARD_LIGHT)
// image(chart, 60, 60)
image(lines, 60, 60)
pop()
}
for(let x=15; x<chart.width; x+=30){
for(let y=15; y<chart.height; y+=30){
let xoff= random(-5, 5)
let yoff= random(-5, 5)
let newX= x+xoff
let newY= y+yoff
let c = floor(noise(newX/50, newY/50) * colors.length)
if(c<5){
let elevation= floor(map(c, 0, 4, 100, 10))
push()
//blendMode(DIFFERENCE)
textSize(7)
textAlign(CENTER, CENTER)
//noFill()
// fill(0, 100)
// ellipse(x+60, y+60, 10)
textFont(font)
fill(0)
noStroke()
text(elevation, newX+60, newY+60)
pop()
}
}
}
fill('#f4f1de')
noStroke()
rect(0, 0, width, 60)
rect(0, 0, 60, height)
rect(340, 0, 60, height)
rect(0, 340, width, 60)
noFill()
textFont(font)
fill(100)
text('1.30', 20, 380)
}
function colorMixer(x,y, colorArray) {
let c = noise(x, y) * colorArray.length
let c1 = floor(c)
let c2 = floor(c + 1) % colorArray.length
let color1 = colorArray[c1]
let color2 = colorArray[c2]
let mix = fract(c)
let coloring = color(spectral.mix(color1, color2, mix))
//coloring.setAlpha(alpha)
return coloring
}