transition question

is that a right code to make the cloud moving infinte from x=250 to x= 390 ?

local function moveSky()
– reset to starting location
transition.to(cloud,{time=6000,x=390})

– transition sky, when finished start over again
transition.to( cloud,{time=3000, x=250, onComplete=moveSky})
end

moveSky() – start moving sky
[import]uid: 96162 topic_id: 35813 reply_id: 335813[/import]

Hello,
I would suggest this:

local function moveSky()  
 -- reset to starting location  
 cloud.x = 250  
 if ( cloud.trans ) then transition.cancel( cloud.trans ) end  
 -- transition sky, when finished start over again  
 cloud.trans = transition.to( cloud,{time=3000, x=390, onComplete=moveSky})  
end  
  
moveSky() -- start moving sky  

Regards,
Brent [import]uid: 200026 topic_id: 35813 reply_id: 142460[/import]

Hello,
I would suggest this:

local function moveSky()  
 -- reset to starting location  
 cloud.x = 250  
 if ( cloud.trans ) then transition.cancel( cloud.trans ) end  
 -- transition sky, when finished start over again  
 cloud.trans = transition.to( cloud,{time=3000, x=390, onComplete=moveSky})  
end  
  
moveSky() -- start moving sky  

Regards,
Brent [import]uid: 200026 topic_id: 35813 reply_id: 142460[/import]