Polyspiral: Difference between revisions

Content added Content deleted
m (Added Lua header)
(Added Lua version)
Line 154: Line 154:
=={{header|Lua}}==
=={{header|Lua}}==
{{libheader|LÖVE}}
{{libheader|LÖVE}}
LÖVE defaults to animating at sixty frames per second, so the patterns become very complex very quickly.
<lang Lua>function love.load ()
love.window.setTitle("Polyspiral")
incr = 0
end

function love.update (dt)
incr = (incr + 0.05) % 360
x1 = love.graphics.getWidth() / 2
y1 = love.graphics.getHeight() / 2
length = 5
angle = incr
end

function love.draw ()
for i = 1, 150 do
x2 = x1 + math.cos(angle) * length
y2 = y1 + math.sin(angle) * length
love.graphics.line(x1, y1, x2, y2)
x1, y1 = x2, y2
length = length + 3
angle = (angle + incr) % 360
end
end</lang>
[[File:love2dPolyspiral.jpg]]


=={{header|PARI/GP}}==
=={{header|PARI/GP}}==