jueves, 19 de mayo de 2011


// An array of news headlines
String[] headlines = {
  "Favor de tomar en cuenta la fecha de entrega de los productos del I Taller Virtual." ,
  "El 23 de mayo es la fecha lìmite para entregar los productos." ,
PFont f; // Global font variable
float x; // Horizontal location
int index = 0;
void setup() {
  f = createFont( "Arial" ,16,true);
  // Initialize headline offscreen
  x = width;
void draw() {
  // Display headline at x location
  textAlign (LEFT);
  // A specific String from the array is displayed according to the value of the "index" variable.
  // Decrement x
  x = x - 3;
  // If x is less than the negative width, then it is off the screen
  // textWidth() is used to calculate the width of the current String.
  float w = textWidth(headlines[index]);
  if (x < -w) {
    x = width;
    // index is incremented when the current String has left the screen in order to display a new String.
    index = (index + 1) % headlines.length;

No hay comentarios: