- Processing
- p5.js
- Processing.py
- Processing for Android
- Processing for Pi

- Processing Foundation

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.

Name | ### pushMatrix()
Examples |
    fill(255);
    rect(0, 0, 50, 50);  // White rectangle

    pushMatrix();
    translate(30, 20);
    fill(0);
    rect(0, 0, 50, 50);  // Black rectangle
    popMatrix();

    fill(100);
    rect(15, 10, 50, 50);  // Gray rectangle
Description | Pushes the current transformation matrix onto the matrix stack. Understanding pushMatrix() and popMatrix() requires understanding the concept of a matrix stack. The pushMatrix() function saves the current coordinate system to the stack and popMatrix() restores the prior coordinate system. pushMatrix() and popMatrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations.
Syntax |
    pushMatrix()
Returns | void
Related | popMatrix() translate() scale() rotate() rotateX() rotateY() rotateZ()

Updated on January 1, 2021 03:38:08am EST
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.