The setTransform() method is a method of the Sprite class. It is used to change the direction of a specified image. It rotates the image in the multiples of 90 degrees and also provides mirrored (about the vertical axis) versions of each of the rotations. The general syntax of this method is as follows:
Here, the transform parameter takes one of the following constant values:
- TRANS_MIRROR: It allows the Sprite to appear reflected about its vertical center.
- TRANS_MIRROR_ROT180: It allows the Sprite to appear reflected about its vertical center and then rotated clockwise by 180 degrees.
- TRANS_MIRROR_ROT90: It allows the Sprite to appear reflected about its vertical center and then rotated clockwise by 90 degrees.
- TRANS_MIRROR_ROT270: It allows the Sprite to appear reflected about its vertical center and then rotated clockwise by 270 degrees.
- TRANS_NONE: It does not transform the image.
- TRANS_ROT90: It allows the Sprite to rotate by 90 degrees clockwise.
- TRANS_ROT180: It allows the Sprite to rotate by 180 degrees clockwise.
- TRANS_ROT270: It allows the Sprite to rotate by 270 degrees clockwise.