xxxxxxxxxx
47
//Fluid Stains
//Created by Mirette Dahab
//January 4th, 2025
//independant work
//all colors
let start = 0;
let inc = 3;
let gradientSpeed = 0.01; // Speed of gradient animation
let gradientOffset = 0; // Offset for scrolling the gradient
let rotationSpeed = 0.005; // Speed of line rotation
let rotationAngle = 0; // Initial rotation angle
function setup() {
createCanvas(410, 410);
colorMode(HSB, 360, 100, 100); // Use HSB color mode for easier hue manipulation
}
function draw() {
// Scroll the gradient smoothly
gradientOffset += gradientSpeed;
let t = noise(gradientOffset);
push();
translate(width / 2, height / 2); // Move to the center of the canvas
rotationAngle += rotationSpeed;
for (let i = 0; i < height; i++) {
let inter = map(i, 0, height, 0, 1);
// Cycle through the hue spectrum by mapping inter + t to the hue range
let hueValue = map((inter + t) % 1, 0, 1, 0, 360);
let c = color(hueValue, 70, 50); // Full saturation and brightness
push();
rotate(rotationAngle + map(i, 0, height, -PI / 20, PI / 20)); // Different rotation for each line
stroke(c);
line(10, i - height / 4, width / 128, i - height / 4); // Line with rotation
pop();
}
pop();
// Increment start for animation
start += inc;
}