]]
local bottom = [[
Show The Code
]]
local nrows = 10
local ncols = 10
local sqsize = 20
local seed = math.random()
local sat = 80
local light = 70
local function rect(x, y, w, h, rx)
local style = string.format('class="shadow" fill="hsla(%s, %s%%, %s%%, %s)"',
seed * 360 - 180, sat, light,
math.random(100) / 100.0)
return string.format(
'', x, y,
w, h, math.random(5, 12), style)
end
local function writeBlock(i, j)
if math.random() < 0.45 then return end
local cellsize = (math.random() > 0.25) and sqsize or math.random(1,4) * sqsize
Write('')
Write(rect(i * sqsize - sqsize, j * sqsize - sqsize, cellsize, cellsize))
Write('')
end
local function render()
nrows = nrows * 3
ncols = ncols * 3
local xsize = nrows * sqsize
local ysize = ncols * sqsize
local style = string.format('style="background-color: hsl(%s,%s%%,%s%%);"',
seed * 360, sat, light)
Write('')
end
Write(top)
Write("