make object float - Please assist.

I know its possible to make an object look as if it is “floating” using a series of transition.to statements…But I dont know how to do it. Would anyone kindly give me a sample to work with?

I already tried to get my object to float by creating boundaries and adding physics and all that, but I think in my personal situation, transition.to would be a better choice. Only thing now is I dont know how to correctly structure the code I need.

So, if you can provide a sample of making an object float within screen boundaries using transition.to statements, I am ever thankful. Thanks in advance. :slight_smile:

local function ghostAnimation() local animUp = function() ghostTween = transition.to( ghostObject, { time=375, y=190, onComplete=ghostAnimation }) end ghostTween = transition.to( ghostObject, { time=375, y=200, onComplete=animUp }) end ghostTween = transition.to( ghostObject, { time=375, y=190, onComplete=ghostAnimation }) 

something like this should work. The idea is to use onComplete params in transition.to
Modify time and x and y to make the object look floating or rather jumping. :) 

Thanks for the help Patso B)

local function ghostAnimation() local animUp = function() ghostTween = transition.to( ghostObject, { time=375, y=190, onComplete=ghostAnimation }) end ghostTween = transition.to( ghostObject, { time=375, y=200, onComplete=animUp }) end ghostTween = transition.to( ghostObject, { time=375, y=190, onComplete=ghostAnimation }) 

something like this should work. The idea is to use onComplete params in transition.to
Modify time and x and y to make the object look floating or rather jumping. :) 

Thanks for the help Patso B)