Here's a recent one:
Code: Select all
screen = {
width = love.graphics.getWidth(),
height = love.graphics.getHeight()
}
local array = {}
--Settings
local amount = 32
local radius = 256
local rotation_speed = 2
local x = screen.width / 2
local y = screen.height / 2
local ball_radius = 0
local line_width = 12
local line_color = {0, 32, 64}
local ball_color = {0, 32, 64}
local background_color = {0, 16, 32}
function love.load()
love.graphics.setBackgroundColor(background_color)
for i=1, amount do
local r = (radius / amount) * i
local s = (rotation_speed / amount) * i
local a = ((math.pi * 2) / amount) * i
array[#array + 1] = {
radius = r,
speed = s,
angle = a,
x = radius * math.cos(a) + x,
y = radius * math.sin(a) + y
}
end
end
function love.update(dt)
for i,v in ipairs(array) do
v.angle = v.angle + v.speed * dt
if v.angle > (math.pi * 2) then v.angle = 0 end
v.x = radius * math.cos(v.angle) + x
v.y = radius * math.sin(v.angle) + y
end
end
function love.draw()
love.graphics.setBlendMode("additive")
love.graphics.setLineWidth(line_width)
for i,v in ipairs(array) do
love.graphics.setColor(line_color)
love.graphics.line(x, y, v.x, v.y)
love.graphics.setColor(ball_color)
love.graphics.circle("fill", v.x, v.y, ball_radius)
end
end
function love.keypressed(key)
if key == "escape" then love.event.push("quit") end
end
(it rotates)