Skip to main content
saratogacoach
Inspiring
February 2, 2013
Answered

Rotating Object Counterclockwise/Clockwise

  • February 2, 2013
  • 1 reply
  • 5628 views

Hi,

I'm not able to use tweening for rotation in a project because when exported for AIR Android, tween gets stuck or runs too slowly on the tablet device. (I also prefer not to use a tween plugin, if possible.)

Instead, I can use rotation, and it works very well on the device.

For example,

if (rotateT){

object.rotation += 5;

}

//coupled with

rotateT= true;

                            if (targetRotation < 180) {

                                targetRotation = object.rotation + 90;

                            }

                            else {

                                targetRotation = -targetRotation + 90;

                            }

                        }

This works well for clockwise rotation.

But, I need some help figuring out how to create a counterclockwise rotation using the same type scripting, if this is possible.

Any help appreciated.

This topic has been closed for replies.
Correct answer Ned Murphy

Just subtract the rotation increment instead of adding it to rotate in the opposite direction.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
February 2, 2013

Just subtract the rotation increment instead of adding it to rotate in the opposite direction.

saratogacoach
Inspiring
February 3, 2013

Thank you, Ned.

I'll give it a try.