PROCESSING
COMANDOS BÁSICOS:
int: Tipo de datos para enteros, números sin punto decimal.
Ejemplos:
a = 23; // Assign 'a' the value 23
Sintaxis:
int varint var = value
float: Tipo de datos para números decimales
Ejemplos:
float a;// Declare variable 'a' of type float
Sintaxis:
float varfloat var = value
Sintaxis:
int varint var = value
float: Tipo de datos para números decimales
Ejemplos:
float a;// Declare variable 'a' of type float
Sintaxis:
float varfloat var = value
text: Dibuja texto en la pantalla.
textSize(128);
Sintaxis:text(c, x, y)text(c, x, y, z)text(str, x, y)text(chars, start, stop, x, y)
rect: Dibuja un rectángulo en la pantalla.
Ejemplos:
size(400, 400);
rect(120, 80, 220, 220);
Sintaxis:
rect(a, b, c, d)rect(a, b, c, d, r)rect(a, b, c, d, tl, tr, br, bl)ellipse:Dibuja una elipse (óvalo) en la pantalla.
Ejemplos:
size(400, 400); ellipse(224, 184, 220, 220);Sintaxis:ellipse(a, b, c, d)delay:La función delay() hace que el programa se detenga por un tiempo específico.Ejemplos:
void setup() {printArray(Serial.list());myPort = new Serial(this, Serial.list()[0], 9600);}Sintaxis:delay(napTime)If:Permite que el programa tome una decisión sobre qué código ejecutar.Ejemplos:for (int i = 5; i < height; i += 5) { stroke(255); // Set the color to white if (i < 35) { // When 'i' is less than 35... stroke(0); //...set the color to black } line(30, i, 80, i);}Sintaxis:
if (test) {
statements
}
for: Controla una secuencia de repeticiones.
Ejemplos:
size(400, 400);for (int i = 0; i < 160; i = i+1) {line(120, i, 320, i);}Sintaxis:for (init; test; update) {
statements
}
for (datatype element : array) {
statements
}
Comentarios
Publicar un comentario