[−][src]Static p5_sys::global::pop
pub static pop: PopInternalType
The push() function saves the current drawing style settings and transformations, while pop() restores these settings. Note that these functions are always used together. They allow you to change the style and transformation settings and later return to what you had. When a new state is started with push(), it builds on the current style and transform information. The push() and pop() functions can be embedded to provide more control. (See the second example for a demonstration.)
push() stores information related to the current transformation state and style settings controlled by the following functions: fill(), noFill(), noStroke(), stroke(), tint(), noTint(), strokeWeight(), strokeCap(), strokeJoin(), imageMode(), rectMode(), ellipseMode(), colorMode(), textAlign(), textFont(), textSize(), textLeading(), applyMatrix(), resetMatrix(), rotate(), scale(), shearX(), shearY(), translate(), noiseSeed().
In WEBGL mode additional style settings are stored. These are controlled by the following functions: setCamera(), ambientLight(), directionalLight(), pointLight(), texture(), specularMaterial(), shininess(), normalMaterial() and shader().
Examples
ellipse(0, 50, 33, 33); // Left circle push(); // Start a new drawing state translate(50, 0); strokeWeight(10); fill(204, 153, 0); ellipse(0, 50, 33, 33); // Middle circle pop(); // Restore original state ellipse(100, 50, 33, 33); // Right circle
ellipse(0, 50, 33, 33); // Left circle push(); // Start a new drawing state strokeWeight(10); fill(204, 153, 0); ellipse(33, 50, 33, 33); // Left-middle circle push(); // Start another new drawing state stroke(0, 102, 153); ellipse(66, 50, 33, 33); // Right-middle circle pop(); // Restore previous state pop(); // Restore original state ellipse(100, 50, 33, 33); // Right circle