MCPcopy
hub / github.com/greensock/GSAP / _segmentToRawPath

Function _segmentToRawPath

esm/MotionPathPlugin.js:69–85  ·  view source on GitHub ↗
(plugin, segment, target, x, y, slicer, vars, unitX, unitY)

Source from the content-addressed store, hash-verified

67// return cubic;
68// },
69_segmentToRawPath = function _segmentToRawPath(plugin, segment, target, x, y, slicer, vars, unitX, unitY) {
70 if (vars.type === "cubic") {
71 segment = [segment];
72 } else {
73 vars.fromCurrent !== false && segment.unshift(_getPropNum(target, x, unitX), y ? _getPropNum(target, y, unitY) : 0);
74 vars.relative && _relativize(segment);
75 var pointFunc = y ? pointsToSegment : flatPointsToSegment;
76 segment = [pointFunc(segment, vars.curviness)];
77 }
78
79 segment = slicer(_align(segment, target, vars));
80
81 _addDimensionalPropTween(plugin, target, x, segment, "x", unitX);
82
83 y && _addDimensionalPropTween(plugin, target, y, segment, "y", unitY);
84 return cacheRawPathMeasurements(segment, vars.resolution || (vars.curviness === 0 ? 20 : 12)); //when curviness is 0, it creates control points right on top of the anchors which makes it more sensitive to resolution, thus we change the default accordingly.
85},
86 _emptyFunc = function _emptyFunc(v) {
87 return v;
88},

Callers 1

Calls 5

cacheRawPathMeasurementsFunction · 0.90
_getPropNumFunction · 0.70
_relativizeFunction · 0.70
_alignFunction · 0.70
_addDimensionalPropTweenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…