I am trying to draw paths with Hummus PDF JS based on paths exported from PaperJS.
Hence PaperJS data output would be the data input for Hummus.
Those two libraries works differently to create curves. PaperJS uses handles to curve a straight lines, while Hummus will curve a line based on 3 points.
Let's say I want to have a curved line that goes through 3 key points: [200, 100] -> [300, 200] -> [400, 100]. Like this picture:
With PaperJS, I will have to do something like this:
var vector = new Point({
angle: 45,
length: 188
});
var path = new Path({
strokeColor: 'blue',
segments: [
[[200, 100], null, vector],
[[400, 100], vector.rotate(90), null]
],
});
However, with Hummus, I will have to use the operator c(inX1,inY1,inX2,inY2,inX3,inY3)
from here
It would be something like this:
c(200, 100, 300, 325, 400, 100);
Unless I am using the wrong operator?
My goal here is just to understand how to get data from PaperJS and make it exploitable to draw with Hummus.