xxxxxxxxxx
67
let colors;
function setup() {
createCanvas(1000, 1000);
angleMode(RADIANS);
colors = [
// https://www.colourlovers.com/palette/4850070/solarizados
color("#BFC7CA"),
color("#F5E19C"),
color("#C3DCD9"),
color("#FCAFB5"),
color("#F1C77F"),
color("#000000"),
];
}
let iter = 0;
let theta = 0;
function draw() {
// background(220);
noStroke();
translate(width / 2, height / 2);
if (iter == 0) drawShadow(20, null, false);
else if (iter == 1) drawShadow(10, null, true);
else drawShadow(5, null, false);
let _x = 5 * cos(theta);
if (frameCount % 10 == 0) {
iter++;
if (iter >= 2) iter = 0;
}
}
function drawShadow(b, g, d) {
if (g == null) {
if (b == 0) {
drawingContext.shadowOffsetX = 0;
drawingContext.shadowOffsetY = 0;
drawingContext.shadowBlur = 0;
drawingContext.shadowColor = color(0); //"black";
} else {
let off = random(0, 10);
if (!d) off *= -1;
let col = random(colors);
drawingContext.shadowOffsetX = off;
drawingContext.shadowOffsetY = off;
drawingContext.shadowBlur = b;
drawingContext.shadowColor = col; //color(0); //"black";
}
} else {
if (b == 0) {
g.drawingContext.shadowOffsetX = 0;
g.drawingContext.shadowOffsetY = 0;
g.drawingContext.shadowBlur = 0;
g.drawingContext.shadowColor = color(0); //"black";
} else {
g.drawingContext.shadowOffsetX = 3;
g.drawingContext.shadowOffsetY = 3;
g.drawingContext.shadowBlur = b;
g.drawingContext.shadowColor = color(0); //"black";
}
}
}