The string of path data commands in cubic bezier format, like "M0,0 C10,20,15,30,5,18 M0,100 C50,120,80,110,100,100"
.
GreenSock Docs
MorphSVGPlugin.rawPathToString()
Converts a RawPath (array) into a string of path data, like "M0,0 C100,20 300,50 400,0..."
which is what's typically found in the d
attribute of a <path>
.
Parameters
rawPath: Array
The RawPath that should be converted to a string.
precision: Number
The maximum number of decimal places that should be used when converting all of the numeric values from the RawPath. For example, 3 would mean that a number like 2.125874896 will be clipped to 2.125. This can be helpful in keeping long path strings more memory-efficient. The default is 2.
Returns : String

Details
Converts a RawPath (array) into a string of path data, like "M0,0 C100,20 300,50 400,0..."
which is what’s typically found in the d
attribute of a <path>
.
A RawPath is basically an array containing an array for each contiguous segment, always populated with cubic bezier data. There’s one segment (array) for each M
command. All of the cubic bezier coordinates are in alternating x, y
format (just like SVG path data) in numeric form which is nice because that way you don’t have to parse a long string and convert things.
So if we had a RawPath that had two M
commands, like the one below:
[
[0, 0, 10, 20, 15, 30, 5, 18],
[0, 100, 50, 120, 80, 110, 100, 100]
]
The resulting string would be:
"M0,0 C10,20,15,30,5,18 M0,100 C50,120,80,110,100,100"
There is also a corresponding MorphSVGPlugin.stringToRawPath()
method so that you can convert back and forth.