* Convert a string-based tween with start and end strings, into a pattern * based tween with arrays.
(propertyName, tween, duration, starting)
| 1981 | * based tween with arrays. |
| 1982 | */ |
| 1983 | function explodeTween(propertyName, tween, duration, starting) { |
| 1984 | var startValue = tween.start, |
| 1985 | endValue = tween.end; |
| 1986 | if (!isString(endValue) || !isString(startValue)) { |
| 1987 | return; |
| 1988 | } |
| 1989 | var sequence = findPattern([startValue, endValue], propertyName); |
| 1990 | if (!sequence && starting) { |
| 1991 | // This little piece will take a startValue, split out the |
| 1992 | // various numbers in it, then copy the endValue into the |
| 1993 | // startValue while replacing the numbers in it to match the |
| 1994 | // original start numbers as a repeating sequence. |
| 1995 | // Finally this function will run again with the new |
| 1996 | // startValue and a now matching pattern. |
| 1997 | var startNumbers = startValue.match(/\d\.?\d*/g) || ["0"], |
| 1998 | count = startNumbers.length; |
| 1999 | var index = 0; |
| 2000 | sequence = findPattern([endValue.replace(/\d+\.?\d*/g, function () { |
| 2001 | return startNumbers[index++ % count]; |
| 2002 | }), endValue], propertyName); |
| 2003 | } |
| 2004 | if (sequence) { |
| 2005 | if (Velocity$$1.debug) { |
| 2006 | console.log("Velocity: Sequence found:", sequence); |
| 2007 | } |
| 2008 | sequence[0].percent = 0; |
| 2009 | sequence[1].percent = 1; |
| 2010 | tween.sequence = sequence; |
| 2011 | switch (tween.easing) { |
| 2012 | case Easings["at-start"]: |
| 2013 | case Easings["during"]: |
| 2014 | case Easings["at-end"]: |
| 2015 | sequence[0].easing = sequence[1].easing = tween.easing; |
| 2016 | break; |
| 2017 | } |
| 2018 | } |
| 2019 | } |
| 2020 | /** |
| 2021 | * Expand all queued animations that haven't gone yet |
| 2022 | * |
no test coverage detected