MCPcopy Index your code
hub / github.com/greensock/GSAP / _tweenComplexCSSString

Function _tweenComplexCSSString

esm/CSSPlugin.js:428–540  ·  view source on GitHub ↗
(target, prop, start, end)

Source from the content-addressed store, hash-verified

426 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value;
427},
428 _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) {
429 // note: we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin.
430 if (!start || start === "none") {
431 // some browsers like Safari actually PREFER the prefixed property and mis-report the unprefixed value like clipPath (BUG). In other words, even though clipPath exists in the style ("clipPath" in target.style) and it's set in the CSS properly (along with -webkit-clip-path), Safari reports clipPath as "none" whereas WebkitClipPath reports accurately like "ellipse(100% 0% at 50% 0%)", so in this case we must SWITCH to using the prefixed property instead. See https://gsap.com/forums/topic/18310-clippath-doesnt-work-on-ios/
432 var p = _checkPropPrefix(prop, target, 1),
433 s = p && _getComputedProperty(target, p, 1);
434
435 if (s && s !== start) {
436 prop = p;
437 start = s;
438 } else if (prop === "borderColor") {
439 start = _getComputedProperty(target, "borderTopColor"); // Firefox bug: always reports "borderColor" as "", so we must fall back to borderTopColor. See https://gsap.com/forums/topic/24583-how-to-return-colors-that-i-had-after-reverse/
440 }
441 }
442
443 var pt = new PropTween(this._pt, target.style, prop, 0, 1, _renderComplexString),
444 index = 0,
445 matchIndex = 0,
446 a,
447 result,
448 startValues,
449 startNum,
450 color,
451 startValue,
452 endValue,
453 endNum,
454 chunk,
455 endUnit,
456 startUnit,
457 endValues;
458 pt.b = start;
459 pt.e = end;
460 start += ""; // ensure values are strings
461
462 end += "";
463
464 if (end.substring(0, 6) === "var(--") {
465 end = _getComputedProperty(target, end.substring(4, end.indexOf(")")));
466 }
467
468 if (end === "auto") {
469 startValue = target.style[prop];
470 target.style[prop] = end;
471 end = _getComputedProperty(target, prop) || end;
472 startValue ? target.style[prop] = startValue : _removeProperty(target, prop);
473 }
474
475 a = [start, end];
476
477 _colorStringFilter(a); // pass an array with the starting and ending values and let the filter do whatever it needs to the values. If colors are found, it returns true and then we must match where the color shows up order-wise because for things like boxShadow, sometimes the browser provides the computed values with the color FIRST, but the user provides it with the color LAST, so flip them if necessary. Same for drop-shadow().
478
479
480 start = a[0];
481 end = a[1];
482 startValues = start.match(_numWithUnitExp) || [];
483 endValues = end.match(_numWithUnitExp) || [];
484
485 if (endValues.length) {

Callers

nothing calls this directly

Calls 6

_colorStringFilterFunction · 0.90
_parseRelativeFunction · 0.90
_checkPropPrefixFunction · 0.70
_getComputedPropertyFunction · 0.70
_removePropertyFunction · 0.70
_convertToUnitFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…