01-27-2018 09:57
01-27-2018 09:57
Hello,
I'm trying to set the relative x to a previous element programmatically. Normally in SVG we can use
$+10
to set the x relative.
But when I do this in javascript I get the following error:
Unhandled TypeError: Argument at index 0 is not a Number
How can I achieve this?
Thank you in advance.
Answered! Go to the Best Answer.
01-27-2018 11:17
01-27-2018 11:17
Using the $ in this way for javascript is not supported.
Have you thought about referencing the coordinates of the preceding element (that $ would be referring to) and use those in your calculation.
import document from "document"; var objectOne = document.getElementById("ObjectOne");
var objectTwo = document.getElementById("ObjectTwo");
objectTwo.x = objectOne.x+10;
objectTwo.y = objectOne.y+25;
01-27-2018 11:17
01-27-2018 11:17
Using the $ in this way for javascript is not supported.
Have you thought about referencing the coordinates of the preceding element (that $ would be referring to) and use those in your calculation.
import document from "document"; var objectOne = document.getElementById("ObjectOne");
var objectTwo = document.getElementById("ObjectTwo");
objectTwo.x = objectOne.x+10;
objectTwo.y = objectOne.y+25;