Skip to content

Add a trail option for fading lines - #31

Open
jorgenbruntveit wants to merge 2 commits into
nilbuild:mainfrom
jorgenbruntveit:trailing-ink-fade
Open

jorgenbruntveit wants to merge 2 commits into
nilbuild:mainfrom
jorgenbruntveit:trailing-ink-fade

Conversation

@jorgenbruntveit

@jorgenbruntveit jorgenbruntveit commented Nov 11, 2026 •

Copy link
Copy Markdown

Adds a fifth choice to Settings → Drawing → Lines fade: Trail behind the pen.

What it does

Instead of the whole line fading after a few seconds, an eraser follows the line from where it started. Nothing is erased while the button is held, so you can draw an underline and keep it there as long as you need. When you release, the eraser waits the start delay and then runs along the line at a steady speed, so a long line takes longer to go than a short one, however fast it was drawn.

When the option is selected, two more rows appear:

  • Erasing starts: a slider from 0.2 to 2 seconds, counted from when you release the line. Default 0.6 s.
  • Erasing speed: Slow, Medium, Fast or Very fast (800, 1400, 2000 or 3000 pt/s). Default Fast.

Both are cleared by Reset like the other settings. Existing choices behave as before.

How

  • The trail uses strokeStart on the line's CAShapeLayer, so the line is erased smoothly along its exact shape. Removing points from the start instead made the line jump and slightly change shape as it shrank.
  • When the line ends, its length (plus the arrowhead, if any) sets the duration of one linear strokeStart animation that begins after the delay. The layer is removed when it finishes.
  • Trail lines are not rasterized.
  • Trail behind the pen is stored as fadeSeconds = -1, so the other values keep their meaning. keep now checks for 0 exactly instead of <= 0.

Testing

Built locally and tested on macOS 27.3 with short and long lines, held for a while before release, at different start and speed settings. The pointer and drawing behave as before with the other fade choices.

This touches the same picker as #27, so whichever lands second will need a small merge there.

"Trail behind the pen" erases each line from its start while you draw,
at a steady speed, so long lines take longer to go than short ones.
When it is selected, Settings shows when erasing starts and how fast
it runs.
While the button is held, nothing is erased. When you let go, the
eraser waits the set delay and then runs along the line from its start
at the set speed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant