the fact is that :
- first loop alpha is decreased
-> so alpha ~= 255 and alpha ~= 0 so nothing is drawn
- second loop alpha ~= 255 and alpha ~= 0 so nothing is changed
-> idem above.
note that in love.draw you do the same whereas somethin or the other
alpha = 255
seconds = 2
function love.update(delayTime)
if alpha >= 255 then -- >= is important because you will pass above 255 without passing by 255 itself look at the addition
decrease=true
elseif alpha <= 0 then -- idem
decrease=false
end
if decrease then
alpha = alpha-(255/seconds*delayTime)
else
alpha = alpha+(255/seconds*delayTime)
end
end
function love.draw()
love.graphics.printf("CodeX Studios Presents...", 0, 250, 800, "center")
love.graphics.setColor(255, 255, 255, alpha)
love.graphics.setNewFont(48)
end
Joe Black wrote:the fact is that :
- first loop alpha is decreased
-> so alpha ~= 255 and alpha ~= 0 so nothing is drawn
- second loop alpha ~= 255 and alpha ~= 0 so nothing is changed
-> idem above.
note that in love.draw you do the same whereas somethin or the other
alpha = 255
seconds = 2
function love.update(delayTime)
if alpha >= 255 then -- >= is important because you will pass above 255 without passing by 255 itself look at the addition
decrease=true
elseif alpha <= 0 then -- idem
decrease=false
end
if decrease then
alpha = alpha-(255/seconds*delayTime)
else
alpha = alpha+(255/seconds*delayTime)
end
end
function love.draw()
love.graphics.printf("CodeX Studios Presents...", 0, 250, 800, "center")
love.graphics.setColor(255, 255, 255, alpha)
love.graphics.setNewFont(48)
end