Applies a counter-clockwise rotation to the texture.

tex:SetRotation(radians[, cx, cy])


Number - Rotation angle in radians. Positive values rotate the texture counter-clockwise.
Number - Horizontal coordinate of the rotation "center" point, defaults to 0.5.
Number - Vertical coordinate of the rotation "center" point, defaults to 0.5.


  • The coordinates are in the image coordinate space: (0,0) is the top left corner of the image, (1,1) is the bottom right corner.
  • This function doesn't quite rotate around the (cx, cy) point: for instance, asking for a zero-radian rotation around (-1, 0) makes the image vanish. The behavior is equivalent to performing the following sequence of affine transformations:
    1. Translate the image by (-cx, -cy)
    2. Scale the image by 2^-0.5
    3. Rotate the image by radians around the origin.
    4. Translate the image by (0.5, 0.5)
  • The scaling applied by this function ensures that a square image rotated by 45 degrees around its center fits within the Texture widget's bounding box. If you're rotating circular textures, you may wish to increase the texture widget's dimensions by a factor of 2^0.5 to keep the original image size.

See also