對於我的代碼(corona SDK),我有一個任意顯示對象「激光」在我觸摸時淡出,並在我放開時重新顯示。然而;在onTouch
函數中,如果我將「開始」轉換alpha設置爲0而不是大於0的任何值,那麼我的顯示對象將永久保持隱藏在0 alpha處。是什麼賦予了?下面的代碼(現在,我使用的α= 0.01,因爲它是非常接近):Corona SDK:如何在轉換完成後重新創建對象?
local function fadeBack(var)
transition.to(laser, {time = 700, alpha = 1.0});
end
local function onTouch(event)
if(event.phase == "began")then
tween = transition.to(laser, {time = 100, alpha = 0});
elseif(event.phase == "ended") then
fadeBack();
end
end