1
0
fractals-love2d/gens/circle.lua
2023-05-11 21:08:04 +03:00

27 lines
580 B
Lua
Executable File

local circleStack
local starting_radius = 250
function insertCircle(pos, radius)
if radius > 2 then
table.insert(circleStack, {pos, radius})
end
end
function drawCircle(pos, radius)
love.graphics.circle("line", pos.x, pos.y, radius)
local offset = Vector2(radius)
insertCircle(pos + offset, radius/2)
insertCircle(pos - offset, radius/2)
end
return function(offset, scale)
circleStack = {}
insertCircle(-offset/scale, starting_radius/scale)
while #circleStack > 0 do
local circle = table.remove(circleStack)
drawCircle(unpack(circle))
end
end