pop_matrix()#

Pops the current transformation matrix off the matrix stack.

Examples#

example picture for pop_matrix()
 1def setup():
 2    py5.fill(255)
 3    py5.rect(0, 0, 50, 50)  # white rectangle
 4
 5    py5.push_matrix()
 6    py5.translate(30, 20)
 7    py5.fill(0)
 8    py5.rect(0, 0, 50, 50)  # black rectangle
 9    py5.pop_matrix()
10
11    py5.fill(100)
12    py5.rect(15, 10, 50, 50)  # gray rectangle

Description#

Pops the current transformation matrix off the matrix stack. Understanding pushing and popping requires understanding the concept of a matrix stack. The push_matrix() function saves the current coordinate system to the stack and pop_matrix() restores the prior coordinate system. push_matrix() and pop_matrix() are used in conjuction with the other transformation functions and may be embedded to control the scope of the transformations.

Underlying Processing method: popMatrix

Syntax#

pop_matrix() -> None

Updated on November 12, 2021 11:30:58am UTC