Skip to content

Instantly share code, notes, and snippets.

@baku89
Created July 29, 2024 14:44
Show Gist options
  • Save baku89/e2320c57b9a4a5a04c2810786ec53219 to your computer and use it in GitHub Desktop.
Save baku89/e2320c57b9a4a5a04c2810786ec53219 to your computer and use it in GitHub Desktop.
const bezier = {
command: 'C',
start: [10, 10],
args: [[90, 90], [10, 90]],
point: [60, 40]
}
const p = Path.fromSegment(bezier)
const nearest = CubicBezier.project(bezier, mouse).position
debug(p, 'skyblue', .4)
stroke(line(mouse, nearest), 'pink', .5)
fill(circle(nearest, 1), 'pink')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment