Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary:This is an initial take on how to allow for value wrapping in Animated (currently `.timing` only). It adds a wrap config options which is an array specifying a range of values to be wrapped around. Anytime the delta of `toValue and fromValue > wrapDistance / 2` instead of animating the long way it will animate towards the range extremity and then after breaching the range it will readjust to animated to the true toValue. Example Usage: ```js Animated.timing( this.state.animatedDegrees, {toValue: Math.random()*360, wrap: [0, 360]} ).start() ``` This is presumably very valuable in rotation based animations, but could also be useful in other applications like wrapping the edges of the viewport. Questions & Todo: - Is `wrap` as a config key semantically meaningful and accurate? - Is there a way to expose this as a config option on `.interpolate` rather than timing - Generalize to all animated API's (spring, decay), and will this work with ValueXY out of the box? - Add tests Closes #5743 Differential Revision: D2979992 fb-gh-sync-id: 69be510feba8c43acb10c253036f5854adff9258 shipit-source-id: 69be510feba8c43acb10c253036f5854adff9258
- Loading branch information