Skip to content

Instantly share code, notes, and snippets.

@furenku
Created October 13, 2023 23:28
Show Gist options
  • Save furenku/4dfc30fc5e50c90c289855c7e2636a7f to your computer and use it in GitHub Desktop.
Save furenku/4dfc30fc5e50c90c289855c7e2636a7f to your computer and use it in GitHub Desktop.
clubcodigo - random y for
var estatura1
var estatura2
var estatura3
var color1
var color2
var color3
var nombres = [ "Jose", "Rebeca", "Ernesto", "Pedro" ]
var nombreAzar
var colors = []
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
colorMode(HSB,255,255,255)
angleMode(DEGREES)
estatura1 = random(140, 200)
estatura2 = random(140, 200)
estatura3 = random(140, 200)
color1 = random(255)
color2 = random(255)
color3 = random(255)
nombreAzar = random( nombres )
colors[0] = random(255)
colors[1] = random(255)
colors[2] = random(255)
colors[3] = random(255)
colors[4] = random(255)
colors[5] = random(255)
colors[6] = random(255)
colors[7] = random(255)
}
function draw() {
background( 100 )
fill(color1, 255, 255 )
rect(width/2 - 100, height/2, 30, estatura1)
fill(color2, 255, 255 )
rect(width/2,height/2, 30, estatura2)
fill(color3, 255, 255 )
rect(width/2 + 100, height/2, 30, estatura3)
text( nombreAzar, 20, 20 )
translate( width / 4, height / 4 )
for( let i = 0; i<nombres.length; i++ ) {
fill( colors[ i ], 255, 255 )
circle( i * 100, 0, 50 )
text( nombres[i], i * 100, -50 )
}
fill(0,0,1)
for( let i = 0; i<nombres.length; i++ ) {
text( nombres[i], 600, i*25 )
}
var aristas = 13
translate( 600, 200 )
for( let i = 0; i<aristas; i++ ) {
var grados = 360 / aristas
rotate( grados )
push()
translate( 50, 0 )
circle( 0, 0, 10 )
pop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment