Toggle navigation
Explora
(current)
Aprende
Crea
Retos
×
Aspectos básicos
void main() {...}
for ( int i = 0 ; i < N ; i++ ) {...}
while (condición) {...}
do {...} while (condición);
if (condición) {...}
if (condición) {...} else {...}
switch (valor) {...}
Mostrar y pedir datos
print()
println()
readInteger()
readDouble()
readChar()
readString()
Funciones matemáticas
abs(n)
log(n)
sqrt(n)
pow(b,e)
floor(n)
ceil(n)
round(n)
sin(n)
cos(n)
tan(n)
asin(n)
acos(n)
atan(n)
random(n)
Funciones gráficas
point(x,y)
line(x1,y1,x2,y2)
ellipse(x,y,w,h)
rect(x,y,w,h)
triangle(x1,y1,x2,y2,x3,y3)
text(msg,x,y)
textWidth(msg)
textSize(n)
background(r,g,b,a)
strokeWeight(n)
stroke(r,g,b,a)
noStroke()
fill(r,g,b,a)
noFill()
image(url, x,y,w,h)
Nuevo
Ayuda
Probar
...
double phi = ( 1+sqrt(5) ) / 2; double constant_c = pow(phi, (2/PI)); double angle = 0; int offsetx = 190; int offsety = 150; double scale = 1.5; double r_anterior = scale * pow(constant_c, 0); void main() { animate(Golden_spiral, 25); }; void Golden_spiral() { if(angle < PI*6) { // formula -> r = a·c^angulo double r = scale*pow(constant_c, angle); // dibujar la línea transformando las coordenadas polares a rectangulares line( r_anterior*cos(angle) + offsetx, r_anterior*sin(angle) + offsety, r*cos(angle+0.1) + offsetx, r*sin(angle+0.1) + offsety); // guardar la distancia del radio r_anterior = r; angle += 0.1; } };
Canvas not supported.
Programado por
Sager
3 votos
414 descargas
219 usos