diff --git a/playdate/source/main.lua b/playdate/source/main.lua index 7b8700b..374fdb7 100644 --- a/playdate/source/main.lua +++ b/playdate/source/main.lua @@ -8,18 +8,17 @@ local numRows = math.floor(screenHeight / glyphWidth) local numCells = numColumns * numRows local numGlyphs = 133 +local numFades = 15 +local blackImage = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack) local glyphTable = gfx.imagetable.new('images/matrix') +local ditherType = gfx.image.kDitherTypeAtkinson local glyphs = {} for i = 1, numGlyphs do - glyphs[i] = glyphTable[i] -end - -local ditherType = gfx.image.kDitherTypeAtkinson -local image = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack) -local numFades = 15 -local fades = {} -for i = 1, numFades do - fades[i] = image:fadedImage(i / numFades, ditherType) + glyphs[i] = {} + local glyph = glyphTable[i] + for j = 1, numFades do + glyphs[i][j] = glyph:blendWithImage(blackImage, 1 - j / numFades, ditherType) + end end local minSpeed = 0.15 @@ -91,8 +90,7 @@ function playdate.update() end if mustDraw then - glyphs[cell.glyphIndex]:draw((cell.x - 1) * glyphWidth, (cell.y - 1) * glyphWidth) - fades[cell.fadeIndex]:draw((cell.x - 1) * glyphWidth, (cell.y - 1) * glyphWidth) + glyphs[cell.glyphIndex][cell.fadeIndex]:draw((cell.x - 1) * glyphWidth, (cell.y - 1) * glyphWidth) end end