1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
let totalPts = 3000; let steps = totalPts + 1; function setup() { createCanvas(710, 400); stroke(255); frameRate(1); setTimeout(drawPoints, 5000); // Llamar a la función drawPoints después de 5 segundos } function drawPoints() { background(0); let rand = 0; for (let i = 1; i < steps; i++) { // Generar un color aleatorio let col = color(random(255), random(255), random(255)); stroke(col); // Establecer el color de trazo como el color aleatorio // Dibujar un punto con el color aleatorio y un tamaño más grande let size = random(1, 2); // Tamaño del punto aleatorio strokeWeight(size); // Establecer el grosor del trazo como el tamaño del punto point((width / steps) * i, height / 2 + random(-rand, rand)); rand += random(-5, 5); } setTimeout(drawPoints, 5000); // Llamar a la función drawPoints nuevamente después de 5 segundos } |