Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
GTween a Sprite along a curve — Gideros Forum

GTween a Sprite along a curve

CesarCesar Member
edited May 2016 in General questions
Hi guys,

What is the best approach to animate (GTween) a sprite along an arc, or along a normal or bezier curve?

Comments

  • @Cesar

    I've never tried tweening a curve, but with GTween a "change" event gets fired every frame as well as on complete.

    An idea off the top of my head is if you're tweening x or anything else, you could apply some maths and adjust the y separately:
     
    local tween = GTween.new(self, 10, {x=100}, {dispatchEvents = true})
     
    function self:curve()
        --->>get the x and apply some trigonometry, or use a look up table or whatever to set the y
       self:setY(YOUR MATHS)
    end
     
    tween:addEventListener("change", self.curve, self)
Sign In or Register to comment.