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

Function _getSampleIndex

esm/utils/paths.js:58–72  ·  view source on GitHub ↗
(samples, length, progress)

Source from the content-addressed store, hash-verified

56 }
57},
58 _getSampleIndex = function _getSampleIndex(samples, length, progress) {
59 // slightly slower way than doing this (when there's no lookup): segment.lookup[progress < 1 ? ~~(length / segment.minLength) : segment.lookup.length - 1] || 0;
60 var l = samples.length,
61 i = ~~(progress * l);
62
63 if (samples[i] > length) {
64 while (--i && samples[i] > length) {}
65
66 i < 0 && (i = 0);
67 } else {
68 while (samples[++i] < length && i < l) {}
69 }
70
71 return i < l ? i : l - 1;
72},
73 _reverseRawPath = function _reverseRawPath(rawPath, skipOuter) {
74 var i = rawPath.length;
75 skipOuter || rawPath.reverse();

Callers 3

getProgressDataFunction · 0.70
getPositionOnPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…