Jump to content

Module:Sandbox/Arccosecant/BouncyTest

From Wikipedia, the free encyclopedia

local cfg = require('Module:Sandbox/Arccosecant/BouncyTest/cfg')
local p = {}

function p._from_entry(entry)
	return "<div style=\"position: fixed; left: 240px; top: 240px; z-index: 500; animation: x-ubox " .. math.random(5,7) .. "." .. math.random(0,9) .. "s linear infinite alternate, y-ubox " .. math.random(4,6) .. "." .. math.random(0,9) .. "s linear infinite alternate\">{{" .. entry .. "}}</div>"
end

function p.select_all(frame)
	ret = ""
	for _,ent in ipairs(cfg) do
		ret = ret .. p._from_entry(ent)
	end
	return frame:preprocess(ret)
end

function p.select_rand(frame)
	ret = ""
	for i=1,frame.args[1] do
		ret = ret .. p._from_entry(cfg[math.random(#cfg)])
	end
	return frame:preprocess(ret)
end

return p