Type Function Object DisplayObject Library display.* Return value none Revision Release 2021.3642 Keywords rotate, rotation See also object.rotation
Effectively adds a value (
deltaAngle) to the object's current rotation. This rotation is based on degrees in the clockwise direction. The rotation occurs around the object's anchor point.
Use object.rotation to set (or get) the current rotation value of the object.
This cannot be used on a physical body during a collision event. However, your collision handler may set a flag or include a time delay via timer.performWithDelay() so that the action can occur in the next application cycle or later. See the Collision Detection guide for a complete list of which APIs and methods are subject to this rule.
object:rotate( deltaAngle )
Number. Degrees to rotate. A positive number rotates the object clockwise and a negative number rotates the object
local rect = display.newRect( 50, 50, 100, 200 ) rect:setFillColor( 1, 0, 0 ) -- Rotate the rectangle 45 degrees rect:rotate( 45 )