Reference for pop_transform
Restore a previously saved transformation state. This is part of the reference section.
Arc
Buffer
Data
Dialog
Ellipse
Geo Utils
Image
Joystick (future)
Keyboard
Line
Mouse / Touchscreen
Pixel
Rectangle
Renderers
Shape
Sound (future)
Style
System
Text
Transform
pop_transform
Purpose
Restore the most recently transformation configuration saved in matrix history, removing that "transform matrix" from the history. This works as a stack (like a stack of plates) where the top of the pile is taken off and restored, removing it from that stack. This will overwrite the current transformation configuration in the sketch.
Snippet
Push and pop the transformation matrix such that things are translated by 50 pixels to the right.
sketch.translate(50, 0) # Translate 50 pixels to the right sketch.push_transform() # Save the current transformation matrix sketch.translate(50, 0) # Translate so now 150 (50 + 100) pixels to the right sketch.pop_transform() # Restore saved matrix so we are 50 pixels to the right again sketch.rect(0, 250, 150, 200) # Draw the rectangle at an offset position of 50, 250.
Examples
Availability
Available on all platforms.