Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Can't create a looping animation of background — Gideros Forum

Can't create a looping animation of background

fliegofliego Member
edited April 2013 in General questions
function BackgroundAnim()
GTween.new(background, 4, {x=-30}, {ease=easing.outBack})
GTween.new(background, 4, {x=-150}, {delay = 4})
GTween.new(background, 4, {x=-270}, {ease=easing.outBack, delay=8})
GTween.new(background, 4, {x=-150}, {delay=12})
end

GTween methods ends at once it start, please, help!

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Hello @fliego
    Here is a way to chain tweens:
    local tween1 = GTween.new(sprite, 1, {x = 240}, {})
    local tween2 = GTween.new(sprite, 1, {y = 100}, {autoPlay = false})
    local tween3 = GTween.new(sprite, 1, {alpha = 0}, {autoPlay = false})
    tween1.nextTween = tween2
    tween2.nextTween = tween3
    Also this is same:
    local tween3 = GTween.new(sprite, 1, {alpha = 0}, {autoPlay = false})
    local tween2 = GTween.new(sprite, 1, {y = 100}, {autoPlay = false, nextTween = tween3})
    local tween1 = GTween.new(sprite, 1, {x = 240}, {nextTween = tween2})

    Likes: fliego

    +1 -1 (+1 / -0 )Share on Facebook
  • is there a way to do it for endless this is not working
    local tween2,tween1
     
    	tween1 = GTween.new(play, 0.5, {scaleX = 1.2,scaleY = 1.2},{nextTween = tween2})
    	tween2 = GTween.new(play, 1, {scaleX = 0.8,scaleY = 0.8},{nextTween = tween1})
    :)
  • did you try to use the onStart, onComplete evens to set the tweens to loop? So for tween2 in the onComplete, you can set function() ... end and set this to loop back to tween1.

    worth a try, what say?

    Likes: hgvyas123

    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
    +1 -1 (+1 / -0 )Share on Facebook
  • great after ending up handling this in enterframe i again ended up with below code
     
    function func1()
    		local myTween = GTween.new(play,0.5,{scaleX = 1.2},{dispatchEvents = true})
    		myTween:addEventListener("complete",func2)
    	end
     
    	function func2()
    		local myTween = GTween.new(play,0.5,{scaleX = 0.8},{dispatchEvents = true})
    		myTween:addEventListener("complete",func1)
    	end
    	func1()
    :)

    Likes: fxone

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.