I think this is because the strokeCap property is read-only. But I would like to know the answer as well.
This snippet from this article seems to work:
/* This plugin adds arrowheads to vectors */
/* Created by Duncan Geere, Jan 2020 */
for (const selection of figma.currentPage.selection) {
const node = selection as VectorNode
/* make a copy of the original node */
let copy = JSON.parse(JSON.stringify(node.vectorNetwork))
/* if it has a strokeCap property, change */
if ("strokeCap" in copy.vertices[copy.vertices.length-1]) {
copy.vertices[copy.vertices.length-1].strokeCap = "ARROW_EQUILATERAL"
copy.vertices[0].strokeCap = "NONE"
}
/* assign the copy back to the original */
node.vectorNetwork = copy
}
Thank you so much @ReneLopez
I came into the same question and got here (a bit late though 😀 ) but I found my solution, to whoever comes for the answer:
node.vectorNetwork={
vertices:[
{x:something,y:something,strokeCap:'SQUARE'},
{x:something,y:something,strokeCap:'ARROW_EQUILATERAL'},
],
segment/region etc.
}