La siguiente consistió en hacer un programa que dibujara el seno de X y, al presionar distintas teclas, este cambiara de color: f loat x; void setup() { size(600, 600); } void draw() { strokeWeight(20); point( x, height/2 + sin(radians(x))*50); x=x+1; } void keyReleased() { if (key =='a') { stroke(154, 62, 255); } if (key =='s') { stroke(111, 140, 255); } } Despúes, vimos como introducir texto en el lienzo, cambiando su tipo de fuente, tamaño y color: void setup() { PFont mono; size(800, 500); background(0, 0, 0); mono = loadFont("Georgia-BoldItalic-70.vlw"); textFont(mono); fill(255, 0, 128); textSize(70); text("Hello", 150, 80); } void draw() { }
Comentarios
Publicar un comentario