FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Topics & Contributions
   Automated Systems
(Moderator: REAS)
   Typehappy
« Previous topic | No topic »

Pages: 1 
   Author  Topic: Typehappy  (Read 515 times)
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Typehappy
« on: Oct 24th, 2002, 5:02am »

/*
 * Typehappy
 * by Martin
 * Based on FontTest by REAS
 *
 * Typehappy produces a collection of the title "Ally McBeal"
 * positioned randomly inside the canvas.
 *  
 * Original intention:
 * Still have to work on how to retain previous string painted
 * even if repaint() is called in each loop.
 *
 */
 
/* Global variables */
    float x = 0;    // X position of the letters  
    float y = 0;    // Y position of the letters  
 
 
    BFont fontA;  
    float a = 0;  
   
/* Initalization - run once */
void setup()  
{    
    size(401, 401);    
    background(0);  
    stroke(255); // sets a white border    
 
    fontA = loadFont("BauerBodoni.vlw.gz");  
    setFont(fontA);  
    hint(SMOOTH_IMAGES);  
 
}    
   
/* Infinite loop */
void loop()    
{    
    /* Draw */
    float r = random(1.0, 8.0);
    scale(r);
    /* Bodoni is the font used for the
     * title of TV series Ally McBeal
     */
    String happy = "Ally McBeal";  
    text(happy, x, y);
 
    /* Update the position */
    x = random(0,100);
    y = random(0,100);
 
    // delay(125);
 
}    
   
 
Martin

122417302122417302martingomez_listsmg1ph WWW Email
Re: Typehappy
« Reply #1 on: Oct 24th, 2002, 5:46am »

/*
 * Typehappy 2
 * by Martin
 * Based on FontTest by REAS
 *
 * Typehappy2 produces a collection of randomly colored
 * random letters of the alphabet positioned randomly
 * inside the canvas.
 *  
 */
 
/* Global variables */
    float x = 0;    // X position of the letters  
    float y = 0;    // Y position of the letters  
    BFont fontA;  
    String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
                      "abcdefghijklmnopqrstuvwxyz";
 
/* Initalization - run once */
void setup()  
{    
    size(401, 401);    
    background(0);  
    fontA = loadFont("BauerBodoni.vlw.gz");  
    setFont(fontA);  
    hint(SMOOTH_IMAGES);    
}    
  
/* Infinite loop */
void loop()    
{    
    int i = 0;
    for( i = 0; i < 5; i++ )
    {
        myDraw();
    }
}    
  
/* Draw stuff */
 
void myDraw()
{
    /* random colors */
    int red = int(random(0,255));
    int green = int(random(0,255));
    int blue = int(random(0,255));
    fill(red,green,blue);
 
    /* random size */
    float r = random(1.0, 15.0);
    scale(r);
 
    /* random letter */
    int character = int(random(1,52));
    String s = alphabet.substring(character, character+1);
 
    /* draw */
    text(s, x, y);
 
    /* update the position */
    x = random(0,80);
    y = random(0,80);
}
 
« Last Edit: Oct 24th, 2002, 5:50am by Martin »  
Pages: 1 

« Previous topic | No topic »