Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Using gtween issue -> how to make a clockwise rotation? (negative rotation parameter dont work) — Gideros Forum

Using gtween issue -> how to make a clockwise rotation? (negative rotation parameter dont work)

paulocarrascopaulocarrasco Member
edited September 2012 in Bugs and issues
Hi, I am using the gtween module to make some transitions, but can't make a clockwise rotation. The sprite always rotatei
in counter clockwise direction.

..
local tween = GTween.new(self, 2,{rotation = -60, scaleX=2,scaleY=2},{ ease = easing.outExponential, repeatCount = 1} )
..

In my opinion this line should make a 60 degrees clockwise rotation. Has anyone solved this issue?

Thanks all.
Tagged:

Comments

  • I haven't used GTween - however I would just create a simple tween from 0 -> 1 and then in an EnterFrame event pickup the tween value and set the rotation myself.
    WhiteTree Games - Home, home on the web, where the bits and bytes they do play!
    #MakeABetterGame! "Never give up, Never NEVER give up!" - Winston Churchill
  • petecpetec Member
    Accepted Answer
    Have you tried rotation=60? That went clockwise for me.
  • Hi again, I have been trying to figure out what is wrong and found a clue, this only happen to sprites that were previously rotated. For instance, in my case I have a sprite that was placed on stage with a 180 rotation and when I make a rotation using gtween I can't make a clockwise rotation on it.
  • petecpetec Member
    edited September 2012 Accepted Answer
    I've just played a bit and if I do this:
    self:setRotation(180)
    GTween.new(self.nj, 2,{rotation=60},{ delay=2} )
    then the tween goes anti-clockwise, but if I do this:
    self:setRotation(-180)
    GTween.new(self.nj, 2,{rotation=60},{ delay=2} )
    the tween goes clockwise but rotates 240 degrees.

    It's because the rotation setting is a sort of heading and not an amount to rotate, so it's going from a heading of 180 to a heading of 60 and it looks like it goes different ways depending on which direction you do the 180 rotation.

    If you want it to rotate 60 degrees then you need to add (for clockwise) or subtract (for anti-clockwise) the amount you want to turn from the sprite's current rotation which you get using getRotation().

    This should give you the 60 degree clockwise you are looking for even if the object has been roatated beforehand:
     GTween.new(self.nj, 2,{rotation=self:getRotation()+60},{ } )
    I hope that's right!

    Likes: paulocarrasco

    +1 -1 (+1 / -0 )Share on Facebook
  • @petec Thank you, thats it...it worked like a charm. :-)
  • @paulocarrasco You're welcome. Glad it helped.
Sign In or Register to comment.