Usage
Implement {{AnimateSprite}}
.
[view | edit | history | purge]The above documentation is transcluded from Module:AnimateSprite/doc.
local p = {}
function p.animate( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
local icons = {}
local sheet = args.sheet or 'InvSprite'
for icon in mw.text.gsplit( args[1], '%s*;%s*' ) do
function image( icon )
local ids = require( 'Module:' .. sheet ).ids
local sprite = require( 'Module:Sprite' ).sprite
local idData = ids[icon]
local image
if idData then
image = sprite{
iddata = idData,
data = sheet
}
end
return image
end
if icon == '' then
table.insert( icons, '<span><br></span>' )
else
table.insert( icons, '<span>' .. image( icon ) .. '</span>' )
end
end
icons[1] = icons[1]:gsub( '^<span>', '<span class="animated-active">' )
return '<span class="animated">' .. table.concat( icons ) .. '</span>'
end
return p