Search processing.org:

Reference for Processing (BETA) version 0135+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.

Name | ### scale()
Examples |
    rect(30, 20, 50, 50);
    scale(0.5);
    rect(30, 20, 50, 50);
    rect(30, 20, 50, 50);
    scale(0.5, 1.3);
    rect(30, 20, 50, 50);
    // Scaling in 3D requires P3D
    // or OPENGL as a parameter to size()
    size(100, 100, P3D);
    fill(255, 102);
    translate(width/2+12, height/2);
    box(20, 20, 20);
    scale(2.5, 2.5, 2.5);
    box(20, 20, 20);
Description | Increasing and decreasing the size of an object by expanding and contracting vertices. Scale values are specified as decimal percentages. The function call scale(2.0) increases the dimension of a shape by 200%. Objects always scale from their relative origin to the coordinate system. Transformations apply to everything that happens after and subsequent calls to the function multiply the effect. For example, calling scale(2.0) and then scale(1.5) is the same as scale(3.0). If scale() is called within draw(), the transformation is reset when the loop begins again. Using this fuction with the z parameter requires passing P3D or OPENGL into the size() parameter as shown in the example above. This function can be further controlled by pushMatrix() and popMatrix().
Syntax |
    scale(size);
    scale(x, y);
    scale(x, y, z);
Parameters |
size | float: percentage to scale the object
x | float: percentage to scale the object in the "x" axis
y | float: percentage to scale the object in the "y" axis
z | float: percentage to scale the object in the "z" axis
Usage | Web & Application
Related | translate() rotate() rotateX() rotateY() rotateZ() pushMatrix() popMatrix()

Updated on October 10, 2006 10:04:01pm PDT