(animatable, target, time, delay, easing, callback, forceAnimate, reverse)
| 4914 | }; |
| 4915 | |
| 4916 | function animateTo(animatable, target, time, delay, easing, callback, forceAnimate, reverse) { |
| 4917 | // animateTo(target, time, easing, callback); |
| 4918 | if (isString(delay)) { |
| 4919 | callback = easing; |
| 4920 | easing = delay; |
| 4921 | delay = 0; |
| 4922 | } |
| 4923 | // animateTo(target, time, delay, callback); |
| 4924 | else if (isFunction$1(easing)) { |
| 4925 | callback = easing; |
| 4926 | easing = 'linear'; |
| 4927 | delay = 0; |
| 4928 | } |
| 4929 | // animateTo(target, time, callback); |
| 4930 | else if (isFunction$1(delay)) { |
| 4931 | callback = delay; |
| 4932 | delay = 0; |
| 4933 | } |
| 4934 | // animateTo(target, callback) |
| 4935 | else if (isFunction$1(time)) { |
| 4936 | callback = time; |
| 4937 | time = 500; |
| 4938 | } |
| 4939 | // animateTo(target) |
| 4940 | else if (!time) { |
| 4941 | time = 500; |
| 4942 | } |
| 4943 | // Stop all previous animations |
| 4944 | animatable.stopAnimation(); |
| 4945 | animateToShallow(animatable, '', animatable, target, time, delay, reverse); |
| 4946 | |
| 4947 | // Animators may be removed immediately after start |
| 4948 | // if there is nothing to animate |
| 4949 | var animators = animatable.animators.slice(); |
| 4950 | var count = animators.length; |
| 4951 | function done() { |
| 4952 | count--; |
| 4953 | if (!count) { |
| 4954 | callback && callback(); |
| 4955 | } |
| 4956 | } |
| 4957 | |
| 4958 | // No animators. This should be checked before animators[i].start(), |
| 4959 | // because 'done' may be executed immediately if no need to animate. |
| 4960 | if (!count) { |
| 4961 | callback && callback(); |
| 4962 | } |
| 4963 | // Start after all animators created |
| 4964 | // Incase any animator is done immediately when all animation properties are not changed |
| 4965 | for (var i = 0; i < animators.length; i++) { |
| 4966 | animators[i] |
| 4967 | .done(done) |
| 4968 | .start(easing, forceAnimate); |
| 4969 | } |
| 4970 | } |
| 4971 | |
| 4972 | /** |
| 4973 | * @param {string} path='' |
no test coverage detected