blinking or flashing objects?

Hi Guys,

I want to make a small round graphic blink (or flash) - can this be done in Corona? I’ve not been able to find any mention of it anywhere.

Thanks

Adrian [import]uid: 83824 topic_id: 16036 reply_id: 316036[/import]

Hi,

No mention? That’s very weird. The transition documentation should be a good start. Use one transition to fade out alpha, and another to fade in. Set both functions as ‘onComplete’ parameters for eachother.

Another way to do this is as follows:

local function blinkenLighten(event)  
 local blinkSpeed = 50 -- bigger value means slower blinking  
 myImage.alpha = (1+math.sin(event.time/blinkSpeed))/2  
end -- BlinkenLighten  
  
Runtime:addEventListener("enterFrame", blinkenLighten)  

Haven’t tested but should just about work,

Cheers,
Thomas [import]uid: 70134 topic_id: 16036 reply_id: 59547[/import]

Hi Thomas, you are absolutely right! I should have realised about the alpha settings having looked at the samples where objects fade out. I was looking for the old fashioned “blink” property. Its been a long day!!!

Thanks for your help

Adrian [import]uid: 83824 topic_id: 16036 reply_id: 59599[/import]

or just set the isVisible to true and false alternatively for a true blink effect

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 16036 reply_id: 59659[/import]