I am trying to emulate a feature on GoodNotes that allows me to draw a glowing curve on a graphic and the moment I let go of the mouse, the curve gradually disappears. See gif below. The gif is a little jumpy because of the limited frames. The curve disappears after maybe 3 seconds.
Thanks to @cvgmt the code below gets us part way there. Now I want the curve to gradually disappear. This works pretty well on the first run... but can't reset the clock for some reason.
DynamicModule[{list = {}, d = 1}, EventHandler[Dynamic[
Graphics[{{Opacity[.2 d], EdgeForm[Blue], FaceForm[],
Rectangle[{-5, -5}, {5, 5}]},
Opacity[.1 d], Red, AbsoluteThickness[16], BezierCurve@list,
Opacity[.2 d], Red, AbsoluteThickness[14], BezierCurve@list,
Opacity[.3 d], Red, AbsoluteThickness[12], BezierCurve@list,
Opacity[.4 d], Red, AbsoluteThickness[10], BezierCurve@list,
Opacity[.5 d], Red, AbsoluteThickness[9], BezierCurve@list,
Opacity[.9 d], Red, AbsoluteThickness[7], BezierCurve@list,
Opacity[.95 d], Red, AbsoluteThickness[5], BezierCurve@list,
Opacity[1 d], Red, AbsoluteThickness[4], BezierCurve@list,
White, AbsoluteThickness[3], BezierCurve@list
}]],
{"MouseDragged" :> (d = 1;
AppendTo[list, MousePosition["Graphics"]]),
"MouseUp" :> (d = Dynamic[1 - Clock[{0, 1, .01}, 3, 1]])
}]]
