Image: appear and desappear constantly

Hi to all!

How could I do this?:

When I start a scene, an image object appear and dissapear for about 5 seconds, until it disappear completely.

Do I have to use a sprite for this or I could use some “trick” using the “object.isVisible”, and/or the transition.to?

Thanks!!

** UPDATED **
 
There are many ways,  another would be:

local timesToHide = 5 local blinkPeriod = 250 local cycles = timesToHide \* 2 + 1 -- One extra to be sure we end on a hide   local circ = display.newCircle( 10, 10, 10 ) circ.blinks = 0 function circ.timer( self ) self.isVisible = not self.isVisible self.blinks = self.blinks + 1 if( self.blinks \>= cycles ) then display.remove(self) end end timer.performWithDelay( blinkPeriod, circ, cycles )

And another way

local circ = display.newCircle( 10, 10, 10 ) transition.blink( circ, { time = 500 } ) timer.performWithDelay( 10000, function() display.remove( circ ); circ = nil; end )

And a combination of concepts

local circ = display.newCircle( 10, 10, 10 ) circ.blinks = 0 function circ.onRepeat(self) self.blinks = self.blinks + 1 if( self.blinks \> 5 ) then transition.cancel( self ) display.remove(self) end end transition.blink( circ, { time = 500, onRepeat = circ } )

Great!! This works perfectly!!

Thanks a lot!

** UPDATED **
 
There are many ways,  another would be:

local timesToHide = 5 local blinkPeriod = 250 local cycles = timesToHide \* 2 + 1 -- One extra to be sure we end on a hide   local circ = display.newCircle( 10, 10, 10 ) circ.blinks = 0 function circ.timer( self ) self.isVisible = not self.isVisible self.blinks = self.blinks + 1 if( self.blinks \>= cycles ) then display.remove(self) end end timer.performWithDelay( blinkPeriod, circ, cycles )

And another way

local circ = display.newCircle( 10, 10, 10 ) transition.blink( circ, { time = 500 } ) timer.performWithDelay( 10000, function() display.remove( circ ); circ = nil; end )

And a combination of concepts

local circ = display.newCircle( 10, 10, 10 ) circ.blinks = 0 function circ.onRepeat(self) self.blinks = self.blinks + 1 if( self.blinks \> 5 ) then transition.cancel( self ) display.remove(self) end end transition.blink( circ, { time = 500, onRepeat = circ } )

Great!! This works perfectly!!

Thanks a lot!