(animationEvent, element, className, animationComplete, options)
| 2007 | } |
| 2008 | |
| 2009 | function animate(animationEvent, element, className, animationComplete, options) { |
| 2010 | //If the animateSetup function doesn't bother returning a |
| 2011 | //cancellation function then it means that there is no animation |
| 2012 | //to perform at all |
| 2013 | var preReflowCancellation = animateBefore(animationEvent, element, className, options.from); |
| 2014 | if (!preReflowCancellation) { |
| 2015 | clearCacheAfterReflow(); |
| 2016 | animationComplete(); |
| 2017 | return; |
| 2018 | } |
| 2019 | |
| 2020 | //There are two cancellation functions: one is before the first |
| 2021 | //reflow animation and the second is during the active state |
| 2022 | //animation. The first function will take care of removing the |
| 2023 | //data from the element which will not make the 2nd animation |
| 2024 | //happen in the first place |
| 2025 | var cancel = preReflowCancellation; |
| 2026 | afterReflow(element, function() { |
| 2027 | //once the reflow is complete then we point cancel to |
| 2028 | //the new cancellation function which will remove all of the |
| 2029 | //animation properties from the active animation |
| 2030 | cancel = animateAfter(animationEvent, element, className, animationComplete, options.to); |
| 2031 | }); |
| 2032 | |
| 2033 | return function(cancelled) { |
| 2034 | (cancel || noop)(cancelled); |
| 2035 | }; |
| 2036 | } |
| 2037 | |
| 2038 | function animateClose(element, className) { |
| 2039 | $$jqLite.removeClass(element, className); |
no test coverage detected