xxxxxxxxxx
let posX, posY;
let stepSize, randomDice;
let colorsArray = [];
let currentColor;
function setup() {
createCanvas(600, 600);
background(30); // Dark background for vibrant contrast
// Initial position of the walker
posX = width / 2;
posY = height / 2;
// Size of each step
stepSize = 15;
// Define an array of bright and bold colors
colorsArray = ['#FF5733', '#FFC300', '#DAF7A6', '#900C3F', '#581845', '#28B463', '#1F618D'];
// Start with a random color
currentColor = random(colorsArray);
}
function draw() {
// Semi-transparent background to create a trail effect
background(30, 30, 30, 10);
// Random walker decision
randomDice = random(1);
if (randomDice < 0.25) {
posX -= stepSize; // Move left
} else if (randomDice < 0.5) {
posX += stepSize; // Move right
} else if (randomDice < 0.75) {
posY -= stepSize; // Move up
} else {
posY += stepSize; // Move down
}
// Wrap around edges
if (posX < 0) posX = width;
if (posX > width) posX = 0;
if (posY < 0) posY = height;
if (posY > height) posY = 0;
// Pick a random color from the palette
currentColor = random(colorsArray);
// Draw geometric shapes with dynamic properties
noStroke();
fill(currentColor);
let dynamicSize = stepSize + sin(frameCount * 0.1) * 10;
if (frameCount % 2 === 0) {
ellipse(posX, posY, dynamicSize, dynamicSize); // Dynamic circle
} else {
rect(posX - dynamicSize / 2, posY - dynamicSize / 2, dynamicSize, dynamicSize); // Dynamic square
}
}