This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Class | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Name | scale() |
||||||||||
Examples | PShape s; void setup() { s = loadShape("bot.svg"); } void draw() { background(204); shape(s); } void mousePressed() { // Shrink the shape 90% each time the mouse is pressed s.scale(0.9); } | ||||||||||
Description |
Increases or decreases the size of a shape by expanding and contracting vertices. Shapes always scale from the relative origin of their bounding box. Scale values are specified as decimal percentages. For example, the method call scale(2.0) increases the dimension of a shape by 200%. Subsequent calls to the method multiply the effect. For example, calling scale(2.0) and then scale(1.5) is the same as scale(3.0). This transformation is applied directly to the shape; it's not refreshed each time draw() is run.
Using this method with the z parameter requires using the P3D parameter in combination with size. |
||||||||||
Syntax | sh.scale(s) sh.scale(x, y) sh.scale(x, y, z) | ||||||||||
Parameters |
| ||||||||||
Returns | void | ||||||||||
Related | rotate() translate() resetMatrix() |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.