| 1989 | }; |
| 1990 | |
| 1991 | var maybeVectorAnim = function( |
| 1992 | value: AnimatedValue | AnimatedValueXY, |
| 1993 | config: Object, |
| 1994 | anim: (value: AnimatedValue, config: Object) => CompositeAnimation |
| 1995 | ): ?CompositeAnimation { |
| 1996 | if (value instanceof AnimatedValueXY) { |
| 1997 | var configX = {...config}; |
| 1998 | var configY = {...config}; |
| 1999 | for (var key in config) { |
| 2000 | var {x, y} = config[key]; |
| 2001 | if (x !== undefined && y !== undefined) { |
| 2002 | configX[key] = x; |
| 2003 | configY[key] = y; |
| 2004 | } |
| 2005 | } |
| 2006 | var aX = anim((value: AnimatedValueXY).x, configX); |
| 2007 | var aY = anim((value: AnimatedValueXY).y, configY); |
| 2008 | // We use `stopTogether: false` here because otherwise tracking will break |
| 2009 | // because the second animation will get stopped before it can update. |
| 2010 | return parallel([aX, aY], {stopTogether: false}); |
| 2011 | } |
| 2012 | return null; |
| 2013 | }; |
| 2014 | |
| 2015 | var spring = function( |
| 2016 | value: AnimatedValue | AnimatedValueXY, |