how can i animate something falling object ?

how can i animate  falling object ?

Can you provide more details?  Is this a physics object (causing it to fall)?  What kind of animation do you want it to do?

Rob

yes sir… its falling object with the use of physics…

i want my object like to blink2 and big small big small…

something like that…

You can probably use transitions for this.   See the transition library: http://docs.coronalabs.com/api/library/transition/index.html

Rob

physics = require "physics" physics.start() local things = {} timer.performWithDelay(100, function() &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local rect &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; rect= display.newRect(0,0, 10,10) &nbsp; &nbsp; rect.anchorX = 0.5 &nbsp; &nbsp; rect.anchorY = 0.5 &nbsp; &nbsp; rect.pulse = true &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; rect.x = math.random() \* display.contentWidth &nbsp; &nbsp; rect.y = math.random() \* display.contentHeight /2&nbsp; &nbsp; &nbsp; physics.addBody(rect, "dynamic") &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; table.insert(things,rect) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local index = table.getn(things) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; transition.to(rect, {time=2000, onComplete=function(event)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.dead = true &nbsp; &nbsp; end}) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; end,0) &nbsp; &nbsp;&nbsp; local ground = display.newRect(display.contentWidth/2, display.contentHeight-25, display.contentWidth\*1.5, 50) physics.addBody(ground, "static") Runtime:addEventListener("enterFrame", function() &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; for i,rect in pairs(things) do &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.dead then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.remove(rect) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; things[i] = nil &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.pulse then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.xScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.yScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.xScale = rect.xScale - 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.yScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.xScale \> 2 then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.pulse = false&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elseif rect.xScale \< 0.5 then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.pulse = true &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end end) &nbsp;

Like this!

If you’re going to use the enterFrame listener you probably don’t need the transition.to.  If you’re going to use the transition.to then you would change the scale and alpha in the transition parameters.

Rob

Can you provide more details?  Is this a physics object (causing it to fall)?  What kind of animation do you want it to do?

Rob

yes sir… its falling object with the use of physics…

i want my object like to blink2 and big small big small…

something like that…

You can probably use transitions for this.   See the transition library: http://docs.coronalabs.com/api/library/transition/index.html

Rob

physics = require "physics" physics.start() local things = {} timer.performWithDelay(100, function() &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local rect &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; rect= display.newRect(0,0, 10,10) &nbsp; &nbsp; rect.anchorX = 0.5 &nbsp; &nbsp; rect.anchorY = 0.5 &nbsp; &nbsp; rect.pulse = true &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; rect.x = math.random() \* display.contentWidth &nbsp; &nbsp; rect.y = math.random() \* display.contentHeight /2&nbsp; &nbsp; &nbsp; physics.addBody(rect, "dynamic") &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; table.insert(things,rect) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; local index = table.getn(things) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; transition.to(rect, {time=2000, onComplete=function(event)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.dead = true &nbsp; &nbsp; end}) &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; end,0) &nbsp; &nbsp;&nbsp; local ground = display.newRect(display.contentWidth/2, display.contentHeight-25, display.contentWidth\*1.5, 50) physics.addBody(ground, "static") Runtime:addEventListener("enterFrame", function() &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; for i,rect in pairs(things) do &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.dead then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; display.remove(rect) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; things[i] = nil &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.pulse then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.xScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.yScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.xScale = rect.xScale - 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.yScale = rect.xScale + 0.2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if rect.xScale \> 2 then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.pulse = false&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elseif rect.xScale \< 0.5 then &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rect.pulse = true &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; &nbsp; &nbsp; end &nbsp; &nbsp; end end) &nbsp;

Like this!

If you’re going to use the enterFrame listener you probably don’t need the transition.to.  If you’re going to use the transition.to then you would change the scale and alpha in the transition parameters.

Rob