i’m running into a weird issue with fade‑out animations and blend modes. here’s my scenario:
- i have a simple grid background (checker of 0.75/0.8 grey)
- on hover of a button i draw a pure white rectangle above it
- when the hover ends, i want that white rect to fade out by reducing its alpha from 1 → 0
my draw code looks like this:
Code: Select all
-- inside button:draw()
if self.buyEffect and self.buyStacks > 0 and self.buyFade > 0 then
-- try to keep it pure white as it fades
love.graphics.setBlendMode("replace")
love.graphics.setColor(1, 1, 1, self.buyFade)
love.graphics.rectangle(
"fill",
self.x,
self.y - (gridSize * self.buyStacks),
gridSize * 10,
gridSize * self.buyStacks
)
love.graphics.setBlendMode("alpha")
love.graphics.setColor(1,1,1,1)
end
- at full alpha it’s bright white as expected
- as soon as self.buyFade dips below 1, the rectangle looks dark grey (almost like it’s blending two greys instead of white → transparent)
- even if i hardcode the alpha to .5 or something it still appears grey
- if i set it to a color it also seems to get dark as it fades.
- the rectangle should stay white while fading out, eventually disappearing to reveal the grid underneath
any pointers would be hugely appreciated—thanks!