Drawing on browser canvas with Lua
local canvas = document:getElementById("canvas") canvas.width = canvas.width -- clear the canvas local ctx = canvas:getContext("2d") ctx.fillStyle = "rgb(200,0,0)" ctx:fillRect(130, 130, 50, 50) ctx.fillStyle = "rgba(0, 0, 200, 0.1)" for i = 1, 100 do ctx:fillRect(math.random(0, 300), math.random(0, 300), 50, 50) end
Read the
description of how this was done
.