I’m trying to mix using this bezier.lua file I found:
local bezier = {} function bezier:curve(xv, yv) local reductor = {\_\_index = function(self, ind) return setmetatable({tree = self, level = ind}, {\_\_index = function(curves, ind) return function(t) local x1, y1 = curves.tree[curves.level-1][ind](t) local x2, y2 = curves.tree[curves.level-1][ind+1](t) return x1 + (x2 - x1) \* t, y1 + (y2 - y1) \* t end end}) end } local points = {} for i = 1, #xv do points[i] = function(t) return xv[i], yv[i] end end return setmetatable({points}, reductor)[#points][1] end return bezier
with the easing transition functions found here: https://docs.coronalabs.com/daily/api/library/easing/index.html.
Is there a smart way to do this? I’m finding that the bezier movement is often don’e with a timer or listener in many iterations of a loop of some kind. But the problem is that the transition.to() call (something like:
transition.to(enemyGroup[1], { x = 300, y = 300, time = 2000, transition=easing.inCubic })
is just called once and I can’t see a way to fit a bezier path in there. Any ideas?
