diff --git a/CHANGELOG.md b/CHANGELOG.md index 910b017b..7fc54a76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - tutorial on partial draw / show creation - Few tests for morphs added - test for partial draw/ show creation +- fix for `follow_path` for objects with `start_pos` other than O ## v0.9.0 (26th of May 2022) - Ability to use Luxor functionality without rendering an animation diff --git a/src/action_animations.jl b/src/action_animations.jl index 9f50c97e..d4f74777 100644 --- a/src/action_animations.jl +++ b/src/action_animations.jl @@ -416,9 +416,9 @@ function _follow_path(video, object, action, rel_frame, points; closed = closed) # if t is discrete and not 0.0 take the last point or first if closed if !isfirstframe && isapprox_discrete(t) if closed - translate(points[1]) + translate(points[1] - object.start_pos) else - translate(points[end]) + translate(points[end] - object.start_pos) end return end @@ -426,16 +426,16 @@ function _follow_path(video, object, action, rel_frame, points; closed = closed) t -= floor(t) if isfirstframe # compute the distances only once for performance reasons - action.defs[:p_dist] = polydistances(points, closed = closed) + action.defs[:p_dist] = polydistances(points .- object.start_pos, closed = closed) end if isapprox(t, 0.0, atol = 1e-4) - translate(points[1]) + translate(points[1] - object.start_pos) return end pdist = action.defs[:p_dist] overshootpoint = get_polypoint_at(points, t; pdist = pdist) - translate(overshootpoint) + translate(overshootpoint - object.start_pos) end """