fractalkitty looking for math? fractalkitty.com

100 days of code

meditate_Day16

#random#trig#interactive#animation

p = 200;
q = 30;
m = 2;
k = 6;
function setup() {
  createCanvas(500, 500);
  angleMode(DEGREES);
  stroke(255);
  strokeWeight(0.5)
  fill(30,40,100,20)
  background(0)
}

function draw() {
  translate(width/2,width/2)
  r = p*sin(frameCount)*cos(frameCount)-q*sin(frameCount)
  theta = frameCount*k
  x = r*cos(theta)
  y = r*sin(theta)
  circle(x,y,m)
  if(frameCount%(360) == 0){
    fill(random(0,200),random(40,250),random(50,255))
    p = random(60,400)
    q = random(10,60)
    m = random(1,10);
    background(0,0,0,10)
  }
}

function mousePressed(){
  background(0);
  k = random(1,9)
  print(k)
  frameCount = 0;
}