xxxxxxxxxx
/*
Inspired by the Tixy land: https://tixy.land/
by Juan Carlos Ponce Campuzano
Date: 12/Dec/2024
*/
let rows = 60;
let cols = 60;
let diameter = 11;
let t = 0;
function setup() {
createCanvas(650, 650);
}
function draw() {
background(0); // Set background color to white
for (let i = 0; i < rows; i++) {
for (let j = 0; j < cols; j++) {
let x = i * (width / cols) + diameter / 2;
let y = j * (height / rows) + diameter / 2;
let r = funRadius(funPattern(myLog(i, -j), myAtan2(i, -j), t));
if (funPattern(myLog(i, -j), myAtan2(i, -j), t) < 0) fill('#e60000');
else fill('#fff');
ellipse(x, y, r);
}
}
t += 0.03;
//console.log(t);
}
let u = 30;
let v = -30;
let myLog = (x, y) => {
x = x - u ;
y = y - v;
if(x == 0 && y == 0){
return 0;
} else return 6 * log(sqrt(x*x + y*y));
}
let myAtan2 = (x, y) => {
x = x - u;
y = y - v;
if(x == 0 && y == 0){
return 0;
} else return 6 * atan2(y, x);
}
let funPattern = (x, y, t) => {
let scale = 1;
return cos( cos(scale * (x ) - t ) + 2 * cos( scale *(y) - abs(sin(scale * (x) - t ) )) );
}
let funRadius = (x) => (diameter * abs(2 / (1 + exp(-5 * x)) - 1));