I am trying to add handles (handleIn, handleOut) to the segments created in Paper.js using a mousetool like the following:
var myPath = new Path();
myPath.strokeColor = 'black';
function onMouseDown(event) {
myPath.add(event.point);
}
At the end of drawing, I close the polygon, and that is when I would like the handles to be generated. Ideally there is a function or settings that would add the missing handles, but if not, any help pointing me in the right direction for how to calculate the handle positions would be greatly appreciated. I don't want to use smooth() or simplify() since I want the original shape of the polygon to remain. I just want to have handles so that I can add subtle curves to specific line segments if necessary.
Handles can be set using segment.handleIn and segments.handleOut properties. Handles are stored relative to the segment point, you just have to make sure they are of the length you want. You can then modify them like any other vector/point. simple demo
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.