Reference for Processing version 1.5. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

### delay()

Examples

    int pos = 0;

    void draw() {
      background(204);
      pos++;
      line(pos, 20, pos, 80);
      delay(250);  // Stops the program for 250 milliseconds
    }

Description

Forces the program to stop running for a specified time. Delay times are specified in thousandths of a second, therefore the function call delay(3000) will stop the program for three seconds. Because the screen is updated only at the end of draw(), the program may appear to "freeze", because the screen will not update when the delay() method is used. This function has no affect inside setup().

Syntax

    delay(milliseconds)

Parameters

milliseconds | int: specified as milliseconds (there are 1000 milliseconds in 1 second)

Returns | None
Usage | Web & Application

Updated on August 30, 2010 04:29:39pm EDT