xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
noLoop()
}
function mouseClicked() {
redraw()
}
function draw() {
colorMode(HSB, 100)
const baseHue = random(100)
const spread = random(1, 25)
const base = color(baseHue, 20, 40)
const colors = []
for (let angle = -2; angle <= 2; angle += 2) {
colors.push(color((baseHue + angle * spread)%100, 30, 80))
}
let heights = colors.map(() => height*0.8/colors.length)
for (let i = 0; i < 4; i++) {
const j = floor(random(heights.length))
const k = floor(random(heights.length))
const off = heights[j] * random(0.1, 0.8)
heights[j] -= off
heights[k] += off
}
colorMode(RGB)
background(base)
brush.push()
brush.noStroke()
// brush.field("seabed")
brush.noField()
let y = -height*0.4
for (let i = 0; i < colors.length; i++) {
// brush.refreshField(frameCount)
brush.fill(colors[i], random(200,255))
brush.bleed(random(0.02,0.05)*heights[i]/max(1,(height*0.8/colors.length)))
brush.fillTexture(0,0)
brush.rect(
-width*0.3 + random(-1,1)*width*0.01,
y + height*0.04,
width*0.6,
heights[i] - height*0.08
)
y += heights[i]
}
brush.pop()
}
function keyPressed() {
save('rothko.png')
}