mirror of
https://github.com/brues-code/TwitchEmotes.git
synced 2026-10-07 06:39:59 +00:00
Add animated emote support
Animate multi-frame sprite-sheet emotes (e.g. :meow:) using ClassicAPI's extended |T texcoord-crop escape, across every context. - TwitchEmotes_animation_metadata (per-sheet frame layout) added to Emotes.lua; animated emotes' base entries cropped to frame 0 so any un-animated context shows a clean first frame, not the whole sheet. - TwitchEmotesAnimator.lua: ~30fps ticker advancing the current frame in chat lines, the autocomplete popup, dropdown menus, chat bubbles, and the stats screen (featured icons + ranked lists). - Re-converted sprite sheets to uncompressed, unflipped, native dimensions (1.12 cannot decode RLE TGA); fixed Clap.tga which was a single 32x32 frame.
This commit is contained in:
+16
-1
@@ -68,11 +68,26 @@ end
|
||||
local function emoteTexStr(emote, size)
|
||||
local tga = emoteTga(emote)
|
||||
if not tga then return "" end
|
||||
-- animated emote sheets: crop to frame 0 (the animator advances the frame)
|
||||
local a = TwitchEmotes_animation_metadata and TwitchEmotes_animation_metadata[tga]
|
||||
if a then
|
||||
return "|T" .. tga .. ":" .. size .. ":" .. size .. ":0:0:" ..
|
||||
a.imageWidth .. ":" .. a.imageHeight .. ":0:" ..
|
||||
a.frameWidth .. ":0:" .. a.frameHeight .. "|t"
|
||||
end
|
||||
return "|T" .. tga .. ":" .. size .. ":" .. size .. "|t"
|
||||
end
|
||||
|
||||
local function setTopEmote(tex, emote)
|
||||
tex:SetTexture(emoteTga(emote) or FALLBACK_TEX)
|
||||
local tga = emoteTga(emote)
|
||||
tex:SetTexture(tga or FALLBACK_TEX)
|
||||
-- store animdata so the animator can crop frames; frame 0 as the base
|
||||
tex.animdata = tga and TwitchEmotes_animation_metadata and TwitchEmotes_animation_metadata[tga]
|
||||
if tex.animdata then
|
||||
tex:SetTexCoord(0, 1, 0, tex.animdata.frameHeight / tex.animdata.imageHeight)
|
||||
else
|
||||
tex:SetTexCoord(0, 1, 0, 1)
|
||||
end
|
||||
end
|
||||
|
||||
local function updateList(lines, sf, keys, statIdx)
|
||||
|
||||
Reference in New Issue
Block a user