diff --git a/playdate/matrix_lua/images/fade-gradient.png b/playdate/matrix_lua/images/fade-gradient.png new file mode 100644 index 0000000..7c8f97f Binary files /dev/null and b/playdate/matrix_lua/images/fade-gradient.png differ diff --git a/playdate/matrix_lua/images/matrix-table-20-20.png b/playdate/matrix_lua/images/matrix-glyphs.png similarity index 100% rename from playdate/matrix_lua/images/matrix-table-20-20.png rename to playdate/matrix_lua/images/matrix-glyphs.png diff --git a/playdate/matrix_lua/main.lua b/playdate/matrix_lua/main.lua index 752d869..3f363e0 100644 --- a/playdate/matrix_lua/main.lua +++ b/playdate/matrix_lua/main.lua @@ -10,16 +10,30 @@ local numRows = floor(screenHeight / glyphWidth) local numCells = numColumns * numRows local numGlyphs = 133 -local numFades = 16 -local blackImage = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack) -local glyphTable = gfx.imagetable.new('images/matrix') -local ditherType = gfx.image.kDitherTypeAtkinson +local numFades = 32 local glyphs = {} -for i = 1, numGlyphs do - glyphs[i] = {} - local glyph = glyphTable[i] - for j = 1, numFades do - glyphs[i][j] = glyph:blendWithImage(blackImage, 1 - j / numFades, ditherType) + +do + local glyphSpritesheet = gfx.image.new('images/matrix-glyphs') + local spritesheetColumns = floor(glyphSpritesheet.width / glyphWidth) + local fadeGradient = gfx.image.new('images/fade-gradient') + local glyph = gfx.image.new(glyphWidth, glyphWidth, gfx.kColorBlack) + + for i = 1, numGlyphs do + local column = (i - 1) % spritesheetColumns + local row = floor((i - 1) / spritesheetColumns) + gfx.lockFocus(glyph) + glyphSpritesheet:draw(-column * glyphWidth, -row * glyphWidth) + gfx.unlockFocus() + glyphs[i] = {} + for j = 1, numFades do + local fade = (j - 1) / (numFades - 1) + local variant = glyph:copy() + glyphs[i][j] = variant + gfx.lockFocus(variant) + fadeGradient:draw(fade * (glyphWidth - fadeGradient.width), 0) + gfx.unlockFocus() + end end end @@ -66,7 +80,7 @@ for x = 1, numColumns do end end -playdate.display.setRefreshRate(24) +playdate.display.setRefreshRate(0) playdate.resetElapsedTime() function playdate.update() diff --git a/playdate/matrix_lua/pdxinfo b/playdate/matrix_lua/pdxinfo index c2f9ae8..c98e9cd 100644 --- a/playdate/matrix_lua/pdxinfo +++ b/playdate/matrix_lua/pdxinfo @@ -1,6 +1,6 @@ name=The Playtrix author=Rezmason -description=A familiar +description=A familiar animation of mysterious raining symbols. bundleID=net.rezmason.theplaytrix version=1.0 buildNumber=1