CÓDIGO
//(C)Sergio Salazar Latorre
//SphereLandScape
//Fabio's Adventure 3D
//Go Painting MultiColor
let l = 900
let ne = 5
let D = l/ne
let r = D/2
let rr = 0
let gg = 180
let bb = 190
let sc = 255
function setup() {
createCanvas(l,l,WEBGL);
angleMode(DEGREES)
background(0)
rr=random(255)
gg=random(255)
bb=random(255)
let sumcol = rr+gg+bb
if (sumcol/3<128){
sc=255
} else {sc=0}
}
function draw() {
stroke(sc)
strokeWeight(0.5)
noFill()
orbitControl()
dibujar()
}
function dibujar(){
//strokeWeight(1)
//stroke(255-rr, 255-gg, 255-bb,50)
for(let i=-10; i<ne ;i=i+2){
for(let j=-9; j<ne; j=j+2){
ponPelota(i,j)
}
}
//strokeWeight(1)
//stroke(rr, gg, bb,50)
for(let i=-9; i<ne ;i=i+2){
for(let j=-10; j<ne; j=j+2){
ponCaja(i,j)
}
}
}
function ponPelota(i,j){
let x = r+2*D*i^2
let y = r+2*D*j^2
let mD = sin(frameCount*1-2*dist(x,y, -l,-l))*1.5
push()
translate(x, y, 0)
fill(rr,gg,bb,100)
let nc=random([5,6])
sphere(D*mD,6)
pop()
}
function ponCaja(i,j){
let x = r+2*D*i^2
let y = r+2*D*j^2
let mD = sin(frameCount*1-2*dist(x,y, -l,-l))*1.5
push()
translate(x, y, 0)
fill(255-rr,255-gg,255-bb,50)
box(D*mD,D,D)
pop()
}



Comentarios
Publicar un comentario