MacuSpiroPlanet

 


CÓDIGO

//(C)Sergio Salazar Latorre

//MacuSpiroPlanet


let l = 600

let D=l*5/8

let r1=((D/2)/10)*8

let r2=((D/2)/10)*5

let r3=((D/2)/10)*3

let a1=0

let a2=0

let a3=0

let a4=0

let x,y

let c1,c2,c3,c4

let sw=1

function inicializaColores(){

  

  c1=color(random(0,255),

                 random(50,255),

                 random(120,128))

  c2=color(random(0,255),

                 random(50,255),

                 random(120,128))

  c3=color(random(0,255),

                 random(50,255),

                 random(120,128))

  c4=color(random(0,255),

                 random(50,255),

                 random(120,128))

}

function inicializaColoresCom(){

  c1=color(random(0,255),

                 random(255-50,255-255),

                 random(255-120,255-128))

  c2=color(random(0,255),

                 random(255-50,255-255),

                 random(255-120,255-128))

  c3=color(random(0,255),

                 random(255-50,255-255),

                 random(255-120,255-128))

  c4=color(random(0,255),

                 random(255-50,255-255),

                 random(255-120,255-128))

}


function setup() {

  createCanvas(l,l);

  background(0)

}


function draw() {

  push()

  if(sw==1){

    inicializaColores()

  } else {

    inicializaColoresCom()

  }

    //background(0);

  noStroke()

  fill(c1)

  let x1 =l/2+sin(a1*0.09)*r1

  let y1 =l/2+cos(a1*0.09)*r1

  circle(x1,y1,3)

  fill(c2)

  let x2=x1+sin(a2*0.2)*r2

  let y2=y1+cos(a2*0.2)*r2

  circle(x2,y2,4)

  fill(c3)

  let x3=x2+sin(a3*0.7)*r3

  let y3=y2+cos(a3*0.7)*r3

  circle(x3,y3,1)

  fill(c4)

  

  let x4=x3+sin(a4*1.2)*r3

  let y4=y3+cos(a4*1.2)*r3

  circle(x4,y4,2)

  

  

  a1+=0.2

  a2+=0.3

  a3+=0.5

  a4+=0.8

  

  if(frameCount>1160){

    if(sw==1){sw=0}else{sw=1}

    frameCount=1

  }

  fill(0)

  strokeWeight(2)

  stroke(255)

  text("(C)Sergio Salazar Latorre", 10, l-13*2)

  text("MacuSpiroPlanet", 10,l-9)

  pop()

}


Comentarios

Entradas populares