Diferencia entre revisiones de «Imagen Escrita: Módulo»
De Casiopea
Sin resumen de edición |
Sin resumen de edición |
||
Línea 8: | Línea 8: | ||
}} | }} | ||
< | <pre><nowiki> | ||
PFont font, small; // declaro dos fuentes | PFont font, small; // declaro dos fuentes | ||
Línea 75: | Línea 75: | ||
} | } | ||
</ | </nowiki></pre> |
Revisión del 18:30 8 abr 2012
Título | Módulo |
---|---|
Tipo de Proyecto | Proyecto de Curso |
Palabras Clave | tarea 3 |
Del Curso | Imagen Escrita 2012, |
Alumno(s) | Alumnus Exemplar |
Profesor | Herbert Spencer |
PFont font, small; // declaro dos fuentes int numIn, numOut, mod; // declaro 3 enteros color rojo; // declaro 1 color void setup(){ size(300, 300); font = createFont("Georgia", 32); // construyo las fuentes (objetos PFont) small = createFont("Georgia", 11); textAlign(CENTER); // defino que el texto será centrado numIn = numOut = 0; // asigno variables mod = 1; rojo = color(255, 100, 100); } void draw(){ background(255); numOut = numIn % mod; // el resultado fill(0); // dibujo el "serrucho" for(int i = 0; i < height; i++){ // pinte rojo si el menor que i if(numIn < i){ stroke(0); } else{ stroke(rojo); } int x = i % mod; line(i, height, i, height-x); } fill(rojo); textFont(font, 32); text(numIn, width*1/6, height/2); text("%", width*2/6, height/2); text(mod, width*3/6, height/2); text("=", width*4/6, height/2); text(numOut, width*5/6, height/2); fill(0); textFont(small, 11); text("a [+]", width*1/6, height*2/5); text("z [-]", width*1/6, height*3/5-textAscent()); text("s [+]", width*3/6, height*2/5); text("x [-]", width*3/6, height*3/5-textAscent()); } // entrada del teclado para controlar el programa void keyPressed(){ if(key =='a'){ numIn++; } if(key =='z'){ numIn--; } if(key =='s'){ mod++; } if((key =='x') && (mod > 1)){ mod--; } }