function setup() {
  createCanvas(innerWidth, innerHeight);
  // noLoop();
}

function draw() {
  background(220);
  
  for(i=0; i<10; i++){
    let diameter = i*10 + i*100*sin((millis()+i*80)/1500);
    let hue = (int)(i*10*millis()/2000)%360;
    console.log(hue);
    drawCircle(diameter, getColor(hue));
   
  }
  

}

function drawCircle(dia, color){
  fill(color);
  noStroke();
  ellipse(innerWidth/2, innerHeight/2, dia, dia);
}

// function calcDiameter(num){
//   return 200 + 100*sin(num/600);
// }

function getColor(hue){
  return color('hsla('+hue+', 80%, 60%, 0.2)');
  
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.min.js