MCPcopy
hub / github.com/tdewolff/minify / animateToShallow

Function animateToShallow

_benchmarks/sample_echarts.js:4931–5027  ·  view source on GitHub ↗
(animatable, topKey, source, target, cfg, animationProps, animators, reverse)

Source from the content-addressed store, hash-verified

4929 }
4930 }
4931 function animateToShallow(animatable, topKey, source, target, cfg, animationProps, animators, reverse) {
4932 var animatableKeys = [];
4933 var changedKeys = [];
4934 var targetKeys = keys(target);
4935 var duration = cfg.duration;
4936 var delay = cfg.delay;
4937 var additive = cfg.additive;
4938 var setToFinal = cfg.setToFinal;
4939 var animateAll = !isObject(animationProps);
4940 for (var k = 0; k < targetKeys.length; k++) {
4941 var innerKey = targetKeys[k];
4942 if (source[innerKey] != null
4943 && target[innerKey] != null
4944 && (animateAll || animationProps[innerKey])) {
4945 if (isObject(target[innerKey]) && !isArrayLike(target[innerKey])) {
4946 if (topKey) {
4947 if (!reverse) {
4948 source[innerKey] = target[innerKey];
4949 animatable.updateDuringAnimation(topKey);
4950 }
4951 continue;
4952 }
4953 animateToShallow(animatable, innerKey, source[innerKey], target[innerKey], cfg, animationProps && animationProps[innerKey], animators, reverse);
4954 }
4955 else {
4956 animatableKeys.push(innerKey);
4957 changedKeys.push(innerKey);
4958 }
4959 }
4960 else if (!reverse) {
4961 source[innerKey] = target[innerKey];
4962 animatable.updateDuringAnimation(topKey);
4963 changedKeys.push(innerKey);
4964 }
4965 }
4966 var keyLen = animatableKeys.length;
4967 if (keyLen > 0
4968 || (cfg.force && !animators.length)) {
4969 var existsAnimators = animatable.animators;
4970 var existsAnimatorsOnSameTarget = [];
4971 for (var i = 0; i < existsAnimators.length; i++) {
4972 if (existsAnimators[i].targetName === topKey) {
4973 existsAnimatorsOnSameTarget.push(existsAnimators[i]);
4974 }
4975 }
4976 if (!additive && existsAnimatorsOnSameTarget.length) {
4977 for (var i = 0; i < existsAnimatorsOnSameTarget.length; i++) {
4978 var allAborted = existsAnimatorsOnSameTarget[i].stopTracks(changedKeys);
4979 if (allAborted) {
4980 var idx = indexOf(existsAnimators, existsAnimatorsOnSameTarget[i]);
4981 existsAnimators.splice(idx, 1);
4982 }
4983 }
4984 }
4985 var revertedSource = void 0;
4986 var reversedTarget = void 0;
4987 var sourceClone = void 0;
4988 if (reverse) {

Callers 1

animateToFunction · 0.85

Calls 6

cloneValueFunction · 0.85
copyValueFunction · 0.85
keysFunction · 0.70
isObjectFunction · 0.70
isArrayLikeFunction · 0.70
indexOfFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…