Name

width

Description

System variable which stores the width of the display window. This value is set by the first parameter of the size() function. For example, the function call size(320, 240) sets the width variable to the value 320. The value of width defaults to 100 if size() is not used in a program.

Examples

  • size(400, 400);
    noStroke();
    background(0);
    rect(0, 160, width, 80);
    rect(0, 240, width/2, 80);
    Image output for example 1