Skip to content

Morph rotation alignment can jump trimmed strokes at the final frame #16

Description

@ronaldmannak

Follow-up to Codex findings on #11 (#11).

When a morph pole is a closed path with a non-default strokeStart/strokeEnd (a partially drawn outline), the rotation alignment introduced in #11 can change the aligned path's start point/parameterization. ManimView trims strokes from the path start, so the visible trimmed segment can shift when the alignment picks a nonzero cyclic offset. This surfaces on both paths that now apply rotation alignment:

  1. Transform pipeline (BezierPath.aligned(with:)ManimScene.apply): apply interpolates the aligned (rotated) paths for 0 < p < 1 but switches to the exact, unrotated target at p >= 1 — so a transform into a partially drawn closed shape can show the wrong edge mid-morph and jump at completion.
  2. Direct interpolate (structurally-matched fast path): same rotation, same trim-start sensitivity, whenever a caller interpolates two trimmed closed paths.

Full strokes (strokeStart == 0 && strokeEnd == 1, the overwhelmingly common case) render identically under any cyclic offset, so they are unaffected either way.

Proposed fix: thread the stroke-trim state into the alignment decision — e.g. aligned(with:minimizeTravel:) and a matching flag on the direct-interpolate fast path — and disable rotation when either pole carries a non-default trim. ManimScene.play passes false when a transform pole is trimmed. That plumbing lives in ManimScene.swift, which #12 is concurrently restructuring, so it's deferred rather than bolted onto #11 to avoid a cross-PR conflict.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions