xxxxxxxxxx
51
//Shayblaban
//Created by Mirette Dahab
//January 4th, 2025
//independant work
let start = 0;
let inc = 1;
let gradientSpeed = 0.5; // Speed of gradient animation
let gradientOffset = 0; // Offset for scrolling the gradient
let rotationSpeed = 2; // Speed of line rotation
let rotationAngle = 180; // Initial rotation angle
function setup() {
createCanvas(410, 410);
}
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;
if(rotationAngle <= 90){
rotationSpeed = 0.02;
}
if(rotationAngle <= 80){
rotationSpeed = 10;
}
// console.log(rotationAngle)
for (let i = 0; i < height/8; i++) {
let inter = map(i, 0, height/i*2, 0, 1);
let c = lerpColor(color('#996300'), color('#f0f09'), (inter + t) % 1); // Wrap the gradient
push();
rotate(rotationAngle + map(i, 0, height, -PI/5 , PI/9 ));
stroke(c);
line(40-4*i, i - height / 4, random(width/128), random(i,i - height / 8)); //line with rotation
pop();
}
pop();
//increment start for animation
start += inc;
}