4 versions in 3 months, but only minor changes


Since the last update in Sep there have been 4 new versions but with only minor changes:

  • Wrapping lines are indicated in the code editor with little grey circles and grey hyphens.
  • Scrollbars have some subtle improvements. They should be easy to acquire even in large files, and you can see some brief landmarks as you scroll. The combination of these changes has made it easier for me to work with large files on a tiny phone. Let me know how you like them, and if there are remaining pain points.
  • Colors are smarter and autoadjust to maintain contrast. You should continue to see all your code no matter how you adjust the foreground and background color in the settings.
  • On Mac OS copy-paste shortcuts use the idiomatic cmd key rather than ctrl.
  • On mobile devices the soft keyboard is now surrounded with a few punctuation keys commonly used in Lua.
  • On mobile devices the soft keyboard pops up in a couple more situations when it didn't used to.

What new programs can I show? I spent some time playing with spirograph patterns, formed by spinning one circle around another. Here's a simple one:

local cx, cy = 500, 300
-- the first circle is twice the radius of the second
local r1, r2 = 100, 50
-- the second circle spins 6 times as fast as the first
local angle1, angle2 = 0, 0
local speed1, speed2 = 1, 6
local history = {}
function car.draw()
  color(.5,.5,.5)
  circle('line', cx, cy, r1)
  local c1x, c1y = cast(cx, cy, r1, angle1)
  circle('line', c1x, c1y, r2)
  local c2x, c2y = cast(c1x, c1y, r2, angle2)
  circle('fill', c2x, c2y, 2)
  color(1,0,0)
  line(c1x,c1y, c2x,c2y)
  table.insert(history, c2x)
  table.insert(history, c2y)
  if #history >= 4 then
    line(history)
  end
end
-- draw a line from (x,y) with a specific length r and angle
function cast(x,y, r, angle)
  return x + r*cos(angle), y + r*sin(angle)
end
function car.update(dt)
  angle1 = angle1 + dt*speed1
  angle2 = angle2 + dt*speed2
end

Here's a slightly more complex program showing how the shape varies as you speed up or slow down the second circle relative to the first. It yields the image up top. Itch.io seems to no longer support uploading animated gifs, so you'll need to run the program to see it evolve.

-- Family of spirographs with different ratios of speeds
-- the ratio of speeds is a fraction p/q (p and q are positive integers)
-- number of steps per orbit
-- if this goes too large and the points of a polyline coincide, you'll get an empty SDL error
local n = 120
local da = 2*pi/n  -- angle increment per step
-- radius of the larger circle
-- the smaller circle is always half the radius of the first
local R = 30
function gcd(a, b)
  if a < b then return gcd(b, a) end
  local r = a%b
  if r == 0 then return b end
  return gcd(b, r)
end
-- draw enough points for the smaller circle to spin q times
-- at that point c1 and c2 both return to their starting positions
function plot_curve(p, q, x, y, r)
  local history, a1, a2 = {}, 0, 0
  local g = gcd(p, q)
  p, q = p/g, q/g
  for a2=0, da*(n*p+1), da do
    local c1x, c1y = cast(x,y, r, a1)
    local c2x, c2y = cast(c1x, c1y, r/2, a2)
    table.insert(history, c2x)
    table.insert(history, c2y)
    a1 = a1 + da*q/p
  end
  return history
end
function cast(x,y, r, angle)
  return x+r*cos(angle), y+r*sin(angle)
end
local Curves = {}
for p = 1,10 do
  for q = 1,10 do
    local x, y = 3.5*p*R+30, 3.5*q*R-10 + Menu_height
    table.insert(Curves, plot_curve(p,q, x,y, R))
  end end
-- global clock
local T = 0
function car.update(dt) T = T + dt end
function car.draw()
  color(1,0,0)
  for i=1,10 do
    g.print(i, 3.5*i*R+30, 15 + Menu_height)
    g.print(('1/%d'):format(i), 45, 3.5*i*R - 10)
  end
  -- static curves
  color(0,0,1, 0.5)
  for _, curve in ipairs(Curves) do
    line(curve)
  end
  -- dynamic part of each curve
  for p = 1,10 do
    for q = 1,10 do
      local x, y = 3.5*p*R+30, 3.5*q*R-10+Menu_height
      local c1x, c1y = cast(x,y, R, T)
      color(1,0,0)
      line(x,y, c1x,c1y)
      local c2x, c2y = cast(c1x, c1y, R/2, T*p/q)
      color(0,0,1)
      line(c1x,c1y, c2x,c2y)
    end end
end

If you try out these programs, first run the screen of abbreviations found in the 'reference' menu.

Files

carousel2-24-en.love 417 kB
Jan 14, 2026
carousel2-24-es-LA.love 421 kB
Jan 14, 2026
carousel2-24-es-ES.love 420 kB
Jan 14, 2026
carousel2-24-de.love 423 kB
Jan 14, 2026
carousel2-24-fr.love 423 kB
Jan 14, 2026
carousel2-24-pt.love 421 kB
Jan 14, 2026
carousel2-24-jp.love 15 MB
Jan 14, 2026
carousel2-24-zh-CN.love 24 MB
Jan 14, 2026

Get Lua Carousel

Leave a comment

Log in with itch.io to leave a comment.