Planetarium

 

Juegue con el Planetarium: Cree su propio Arte…

Play with Planetarium: Create your own Art…


CÓDIGO


//(C)Sergio Salazar Latorre

//Fabio's Adventure 3D

//Planetarium


let l = 600


function setup() {

  createCanvas(l,l,WEBGL);

  background(0)

}


function draw() {

  orbitControl()

  

  configurarCanvas()

  planetarium()

}


function configurarCanvas(){

  translate(0,0,-1000)

  rotateX(-45)

  rotateY(45)

  

  //fill(0,0,255,00)

  strokeWeight(1)

  //stroke(255,0,0,10)

  angleMode(DEGREES)

}


function planetarium(){

  D1=80

  cox = 0

  coy = 0

  coz = 0

  vox = 0.8

  voy = 0.8

  voz = 0.8

  rox = 200

  roy = 300

  roz = 500

  x1 = sin(frameCount*vox)*rox

  y1 = 0

  z1 = cos(frameCount*voz)*roz

  push()

  translate(x1,y1,z1)

  fill(255,128,0)

  sphere(D1)

  pop()

  //........

  D2=30

  vox = 2

  voy = 2

  voz = 2

  rox = 200

  roy = 200

  roz = 0

  x2 = x1+sin(frameCount*vox)*rox

  y2 = y1+cos(frameCount*voy)*roy

  z2 = z1

  push()

  translate(x2,y2,z2)

  fill(128,255,0)

  sphere(D2)

  pop()

  

  //........

  D3=20

  vox = 3

  voy = 3

  voz = 3

  rox = 80

  roy = 80

  roz = 0

  x3 = x2+sin(frameCount*vox)*rox

  y3 = y2

  z3 = z2+cos(frameCount*voy)*roy

  push()

  translate(x3,y3,z3)

  fill(255,128,255)

  strokeWeight(0.4)

  sphere(D3)

  pop()

  //...

  D4=10

  vox = 8

  voy = 8

  voz = 8

  rox = 50

  roy = 50

  roz = 50

  x4 = x3+sin(frameCount*vox)*rox

  y4 = y3+cos(frameCount*voz)*roz

  z4 = z3

  push()

  translate(x4,y4,z4)

  

  fill(255,255,0)

  strokeWeight(0.2)

  sphere(D4)

  pop()

}




Comentarios

Entradas populares