Nice! I can’t wait to try it.
@time_trial I have something to add, how are you animating the ball? Tweens or through custom paths? If it’s custom paths then a feature to add would be cat mull rom algorithm for animating smooth curves without averaging between points like a bezier curve. This way you can set the speed of the moving object using the spacing of points, I’ve seen it done in a few scripts for things like dynamic camera movement with set speeds.
@Luatee, I tween a player mesh to the position buffers of each page’s mesh. Had considered your bezier class to allow setting a custom path, but I don’t know how to allow for that whilst using position buffers.
Thanks for the idea, I will certainly look into it.
The bezier class isn’t as good for custom paths because cat mull rom follows all the points and passes through them whereas bezier averages towards them. If you would like I can send you my function for creating a new curve out of existing points using the cat mull algorithm.
@Ignatz Suppose that’s better for everyone :)>-
It’s 2D, not too hard to make it 3D.
function Smooth( points, stepamnt )
--Adapted from https://gist.github.com/pr0digy/1383576
if #points < 3 then return points end
local newpoints = {}
local p1, p2, p3, p4, pos
for i = 1, #points-1 do
if i == 1 then
p1, p2, p3, p4 = points[i], points[i], points[i + 1], points[i + 2]
elseif i == #points-1 then
p1, p2, p3, p4 = points[#points - 2], points[#points - 1], points[#points], points[#points]
else
p1, p2, p3, p4 = points[i - 1], points[i], points[i + 1], points[i + 2]
end
for i = 0, stepamnt do
local t = i/stepamnt
pos = 0.5*((2*p2)+(-p1+p3)*t+(2*p1-5*p2+4*p3-p4)*(t^2)+(-p1+3*p2-3*p3+p4)*(t^3))
if newpoints[#newpoints]~=pos then
table.insert(newpoints,vec2(pos.x,pos.y))
end
end
end
return newpoints
end
Thanks, @Luatee, although I’m not sure how I would implement this in my project. I just tween between position buffers of each page’s mesh, which creates a stream of positions for each rectangle in each mesh.
I do need to try to allow for objects not being shown in every page, which I have planned to allow the user to do by setting a flag which sets its rectangles’ alpha to zero in the selected page. That requires manipulating the position buffer tweens, which I think is how I would implement a curved path. I’ll have a think on that whilst I get on with other elements.
I wouldn’t use Tweens for the custom paths, but it’s your choice. If you need help implementing it send me a pm.
Hi,
Just a quick note to say this app finally went live today. Renamed Easy Animator, as it grew beyond the original concept of only animating drawn lines. iTunes link - https://itunes.apple.com/gb/app/easy-animator/id1066007368?mt=8.
Not built in Codea, but prototyped on it and inspired by this community and the achievements from its coders.
Thanks for the early advice and good luck with your own projects.
Rob.