MCPcopy Create free account
hub / github.com/ptmt/react-native-macos / spring

Function spring

Libraries/Animated/src/AnimatedImplementation.js:2015–2061  ·  view source on GitHub ↗
(
  value: AnimatedValue | AnimatedValueXY,
  config: SpringAnimationConfig,
)

Source from the content-addressed store, hash-verified

2013};
2014
2015var spring = function(
2016 value: AnimatedValue | AnimatedValueXY,
2017 config: SpringAnimationConfig,
2018): CompositeAnimation {
2019 var start = function(
2020 animatedValue: AnimatedValue | AnimatedValueXY,
2021 configuration: SpringAnimationConfig,
2022 callback?: ?EndCallback): void {
2023 callback = _combineCallbacks(callback, configuration);
2024 var singleValue: any = animatedValue;
2025 var singleConfig: any = configuration;
2026 singleValue.stopTracking();
2027 if (configuration.toValue instanceof Animated) {
2028 singleValue.track(new AnimatedTracking(
2029 singleValue,
2030 configuration.toValue,
2031 SpringAnimation,
2032 singleConfig,
2033 callback
2034 ));
2035 } else {
2036 singleValue.animate(new SpringAnimation(singleConfig), callback);
2037 }
2038 };
2039 return maybeVectorAnim(value, config, spring) || {
2040 start: function(callback?: ?EndCallback): void {
2041 start(value, config, callback);
2042 },
2043
2044 stop: function(): void {
2045 value.stopAnimation();
2046 },
2047
2048 reset: function(): void {
2049 value.resetAnimation();
2050 },
2051
2052 _startNativeLoop: function(iterations?: number): void {
2053 var singleConfig = { ...config, iterations };
2054 start(value, singleConfig);
2055 },
2056
2057 _isUsingNativeDriver: function(): boolean {
2058 return config.useNativeDriver || false;
2059 }
2060 };
2061};
2062
2063var timing = function(
2064 value: AnimatedValue | AnimatedValueXY,

Callers

nothing calls this directly

Calls 4

maybeVectorAnimFunction · 0.85
startFunction · 0.70
stopAnimationMethod · 0.45
resetAnimationMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…