How can I pause the cycle between black, clear, and black again to stay at the clear?
Otherwise, if someone could explain the tween.lua library's fade to me, I would appreciate it. I originally chose the code below because I had difficulty implementing tween.lua's fade. Thanks!
Code: Select all
function love.load()
timer = 0
alpha = 0
fadein = 2
display = 7
fadeout = 9
image = love.graphics.newImage("background01.png")
end
function love.update(dt)
timer=timer+dt
if timer<fadein then alpha=timer/fadein
elseif timer<display then alpha=1
elseif timer<fadeout then alpha=1-((timer-display)/(fadeout-display))
else alpha=0 end
end
function love.draw()
love.graphics.setColor(255, 255, 255, alpha*255)
love.graphics.draw(image, 0, 0)
end