Module:Sprite: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 14: Line 14:
local cellWidth = sheetWidth / noOfColumns
local cellWidth = sheetWidth / noOfColumns
local cellHeight = sheetHeight / noOfRows
local cellHeight = sheetHeight / noOfRows
local outline = tonumber(frame.args['outline'])
local outlineCss
if outline == 1 then
outlineCss = "drop-shadow(0.5px 0.5px 0 black) drop-shadow(-0.5px -0.5px 0 black) drop-shadow(-0.5px 0.5px 0 black) drop-shadow(0.5px -0.5px 0 black)"
else
outlineCss = ""
end
local span = mw.html.create('span')
local span = mw.html.create('span')
:css({
:css({
Line 30: Line 36:
width = tostring(sheetWidth * ratio) .. 'px',
width = tostring(sheetWidth * ratio) .. 'px',
top = tostring((offsetY - cellHeight * row) * ratio) .. 'px',
top = tostring((offsetY - cellHeight * row) * ratio) .. 'px',
left = tostring((offsetX - cellWidth * col) * ratio) .. 'px'
left = tostring((offsetX - cellWidth * col) * ratio) .. 'px',
filter = outlineCss
})
})
:wikitext(string.format('[[%s|%dpx|class=pixelart]]', image, sheetWidth * ratio))
:wikitext(string.format('[[%s|%dpx|class=pixelart]]', image, sheetWidth * ratio))