I intend to draw circles tangent to each other at random points with no looping, but so far it doesn’t work as expected.
let r = 20;
function setup() {
createCanvas(600, 600);
}
function draw() {
background(255);
translate(300, 300);
ellipse(0, 0, 2, 2);
noFill()
for (let i = 0; i < 3; i++) {
push();
let randomNoise = random(0, 180);
let xr = cos(radians(randomNoise)),
yr = sin(radians(randomNoise));
let radius = 60 + 2 * i * r;
translate(r * i * xr, r * i * yr);
console.log(r);
console.log(radius);
ellipse(0, 0, radius,radius);
pop();
}
noLoop()
}
The biggest circle is supposed to be tangent with the second biggest at an arbitrary point, but they are intersecting.