Interpolate Points on a Line


/ Published in: JavaScript
Save to your folder(s)

This function will interpolate the points on a line. When tracking mouse movements, not every point is captured. This is especially true the faster the mouse moves. This function will allow you to fill in the gap of points between two recorded positions. It takes two point values (object with an "x" and a "y" property) and the distance to move forward for each new point to be added (e.g. spacing). The result is an array containing all the points between the two points provided in the function call.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.