DRAW_POINTS = 100 MIN = 20 MAX = 700 cx = 20 cy = 20 all_points = {} function resetCurve() local ctrl = {cx, cy} for i=0, 2 do cx = love.math.random( MIN, MAX ) cy = love.math.random( MIN, MAX ) table.insert(ctrl, cx) table.insert(ctrl, cy) end curve = love.math.newBezierCurve(ctrl) points = 0 end function love.load() resetCurve() end function love.update(dt) points = points + 1 if points > DRAW_POINTS then resetCurve() end local x, y = curve:evaluate(points/DRAW_POINTS) table.insert(all_points, {x, y}) end function love.draw() love.graphics.setBackgroundColor( 0.3, 0.3, 0.30) love.graphics.setColor(0.3, 0, 0, 0.1) love.graphics.line(curve:render()) love.graphics.setColor(1, 0, 0) for i, point in pairs(all_points) do love.graphics.points(point) end end