BIG EYE: Movimiento Circular

 


Código 

//(C)Sergio Salazar Latorre

//BIG EYE (can see all)

let a = 0;

let l=400

let r = 125

let re=5

function setup() {

  createCanvas(l, l);

  

  background(0)

}


function draw() {

  //background(0);

  fill(255)

  circle(200,200,50)


  // Calcula las coordenadas x e y en función del ángulo

  let xe = width  / 2 + cos(a) * re;

  let ye = height / 2 + sin(a) * re;

  fill(0)

  stroke(0)

  strokeWeight(1)

  circle(xe,ye,35)

  fill(255)

  xe = width  / 2 + cos(a) * re-5;

  ye = height / 2 + sin(a) * re-5;

  circle(xe+5,ye+5,10)

  fill(255)

  let x = width  / 2 + cos(a) * r;

  let y = height / 2 + sin(a) * r;


  // Dibuja el cuadrado en las coordenadas calculadas

  rectMode(CENTER);

  rect(x, y, 150, 50);

  fill(0)

  stroke(0)

  text('BIG EYE',x-25,y-5)

  text('(c) SergioSalazarLatorre',x-65,y+5)

  


  // Incrementa el ángulo para que el cuadrado se mueva a lo largo de la trayectoria circular

  a += 0.03;

}


Comentarios

Entradas populares