コロナでタスクを実行したらどうやって待つことができますか?コロナで待つ方法
timer.performwithdelay()
タスクを実行する前に待機しますが、タスクを実行した後に待機したいと考えています。それを行う方法はありますか? 実際には5秒間画像を表示します。
コロナでタスクを実行したらどうやって待つことができますか?コロナで待つ方法
timer.performwithdelay()
タスクを実行する前に待機しますが、タスクを実行した後に待機したいと考えています。それを行う方法はありますか? 実際には5秒間画像を表示します。
https://docs.coronalabs.com/api/library/timer/index.html
https://forums.coronalabs.com/topic/50088-how-to-wait-a-certain-amount-of-time/
function afterTimer()
print("Timer is done!")
print("Now do something else")
end
timer.performWithDelay(3000, afterTimer, 1)
実行するタスクは、オブジェクトをインスタンス化した後DisplayObject
上(フェードアウトのような)だけの移行であれば維持、
local image
function afterTimer()
-- hide image
image.alpha = 0
-- or use
-- image.isVisible = false
-- or remove it
-- display.remove(image); image = nil
end
image = display.newImage("nameOfImage.png")
timer.performWithDelay(5000, afterTimer, 1)
をお試しくださいライブラリtransition
のすべての機能で利用できるdelay
パラメータを念頭に置いてくださいコロナで
例えば、5秒、それを作成した後、あなたの画像を非表示にする:
:local image = display.newImage(...
transition.fadeOut(image, { delay = 5000, time = 250 }
をあなたはそれがフェードアウトした後、シーンからimage
DisplayObjectを削除したい場合は、完了ハンドラを追加することができます
local image = display.newImage(...
local function onFadeOutComplete(obj)
obj:removeSelf()
obj = nil
end
transition.fadeOut(image, {delay = 5000, time = 250, onComplete = onFadeOutComplete })
google "コロナ待機"をクリックして最初のヒット、読み込み、実装... – Piglet