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

Function _replaceRandom

esm/gsap-core.js:873–880  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

871 });
872},
873 _replaceRandom = function _replaceRandom(s) {
874 return s.replace(_randomExp, function (match) {
875 //replaces all occurrences of random(...) in a string with the calculated random value. can be a range like random(-100, 100, 5) or an array like random([0, 100, 500])
876 var arIndex = match.indexOf("[") + 1,
877 values = match.substring(arIndex || 7, arIndex ? match.indexOf("]") : match.length - 1).split(_commaDelimExp);
878 return random(arIndex ? values : +values[0], arIndex ? 0 : +values[1], +values[2] || 1e-5);
879 });
880},
881 mapRange = function mapRange(inMin, inMax, outMin, outMax, value) {
882 var inRange = inMax - inMin,
883 outRange = outMax - outMin;

Callers 4

CSSPlugin.jsFile · 0.90
_addPropTweenFunction · 0.70
_parseFuncOrStringFunction · 0.70

Calls 2

randomFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…