Reference for translate
Change the location of the origin. 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
translate
Purpose
Change the transform matrix such that any drawing afterwards is moved by a set amount.
Snippet
Draw an offset rectangle.
sketch.translate(50, 0) # Translate 50 pixels to the right sketch.rect(0, 250, 150, 200) # Draw the rectangle at an offset position of 50, 250.
Parameters
- x: The number of pixels to offset horizontally.
- y: The number of pixels to offset vertically.
Examples
Availability
Available on all platforms.