- 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.

Class | PShape
Name | ### rotateY()
Examples |
    PShape s;

    void setup() {
      size(100, 100, P3D);
      s = loadShape("ohio.svg");
    }

    void draw() {
      background(204);
      shape(s);
    }

    void mousePressed() {
      // Rotate the shape around the y-axis each time the mouse is pressed
      s.rotateY(0.1);
    }
Description | Rotates the shape around the y-axis the amount specified by the angle parameter. Angles should be specified in radians (values from 0 to TWO_PI) or converted from degrees to radians with the radians() method. Shapes are always rotated around the upper-left corner of their bounding box. Positive numbers rotate objects in a clockwise direction. Subsequent calls to the method accumulates the effect. For example, calling rotateY(HALF_PI) and then rotateY(HALF_PI) is the same as rotateY(PI). This transformation is applied directly to the shape, it's not refreshed each time draw() is run. This method requires a 3D renderer. You need to use P3D as a third parameter for the size() function as shown in the example above.
Syntax |
    sh.rotateY(angle)
Parameters |
sh | PShape: any variable of type PShape
angle | float: angle of rotation specified in radians
Returns | void
Related | rotate() rotateX() rotateZ() scale() translate() resetMatrix()

Updated on July 4, 2018 11:56:45am EDT