Hi,
I’m trying to make a coin blinks for 2 secs. To accomplish that I’m using transition.blink(coin,{time=3000}), however it makes the coin to blink forever.
It might be a bug of this method or I’m doing something wrong
This is the code snippet:
local coin = display.newImageRect( “images/coin.png”, 50,50)
coin.x = 200; coin.y = 100;
transition.blink(coin,{time=3000,onComplete=function(obj) coin:removeSelf(); coin=nil; end;})
I’m using corona simulator 2014.2189 (2014.3.6)
Any clue on this is appreciated
Olman
The time param is how long one blink takes, then it blinks at that speed forever. There is no iteration parameter specified in the docs, so I don’t think you can use it like you want and you better to go with a regular transition.to for example.
You could do something like this:
local coin = display.newImageRect( "images/coin.png", 50,50) coin.x = 200; coin.y = 100; coin.trans = transition.blink(coin,{time=500}) local function killBlink() transition.cancel(coin.trans) display.remove(coin) coin=nil end timer.performWithDelay(2000, killBlink)
You’re still using transition.blink() but now you’re setting a timer to kill it after 2 seconds.
Jay
The time param is how long one blink takes, then it blinks at that speed forever. There is no iteration parameter specified in the docs, so I don’t think you can use it like you want and you better to go with a regular transition.to for example.
You could do something like this:
local coin = display.newImageRect( "images/coin.png", 50,50) coin.x = 200; coin.y = 100; coin.trans = transition.blink(coin,{time=500}) local function killBlink() transition.cancel(coin.trans) display.remove(coin) coin=nil end timer.performWithDelay(2000, killBlink)
You’re still using transition.blink() but now you’re setting a timer to kill it after 2 seconds.
Jay