(scrollTo, vars, initialValue, change1, change2)
| 869 | prop = "_scroll" + direction.p2, |
| 870 | // add a tweenable property to the scroller that's a getter/setter function, like _scrollTop or _scrollLeft. This way, if someone does gsap.killTweensOf(scroller) it'll kill the scroll tween. |
| 871 | getTween = function getTween(scrollTo, vars, initialValue, change1, change2) { |
| 872 | var tween = getTween.tween, |
| 873 | onComplete = vars.onComplete, |
| 874 | modifiers = {}; |
| 875 | initialValue = initialValue || getScroll(); |
| 876 | |
| 877 | var checkForInterruption = _interruptionTracker(getScroll, initialValue, function () { |
| 878 | tween.kill(); |
| 879 | getTween.tween = 0; |
| 880 | }); |
| 881 | |
| 882 | change2 = change1 && change2 || 0; // if change1 is 0, we set that to the difference and ignore change2. Otherwise, there would be a compound effect. |
| 883 | |
| 884 | change1 = change1 || scrollTo - initialValue; |
| 885 | tween && tween.kill(); |
| 886 | vars[prop] = scrollTo; |
| 887 | vars.inherit = false; |
| 888 | vars.modifiers = modifiers; |
| 889 | |
| 890 | modifiers[prop] = function () { |
| 891 | return checkForInterruption(initialValue + change1 * tween.ratio + change2 * tween.ratio * tween.ratio); |
| 892 | }; |
| 893 | |
| 894 | vars.onUpdate = function () { |
| 895 | _scrollers.cache++; |
| 896 | getTween.tween && _updateAll(); // if it was interrupted/killed, like in a context.revert(), don't force an updateAll() |
| 897 | }; |
| 898 | |
| 899 | vars.onComplete = function () { |
| 900 | getTween.tween = 0; |
| 901 | onComplete && onComplete.call(tween); |
| 902 | }; |
| 903 | |
| 904 | tween = getTween.tween = gsap.to(scroller, vars); |
| 905 | return tween; |
| 906 | }; |
| 907 | |
| 908 | scroller[prop] = getScroll; |
| 909 |
nothing calls this directly
no test coverage detected
searching dependent graphs…