Blame view

天文台pc/tianwentai-ui/node_modules/motion-dom/dist/es/value/spring-value.mjs 1.03 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
  import { attachFollow, followValue } from './follow-value.mjs';
  
  /**
   * Create a `MotionValue` that animates to its latest value using a spring.
   * Can either be a value or track another `MotionValue`.
   *
   * ```jsx
   * const x = motionValue(0)
   * const y = springValue(x, { stiffness: 300 })
   * ```
   *
   * @param source - Initial value or MotionValue to track
   * @param options - Spring configuration options
   * @returns `MotionValue`
   *
   * @public
   */
  function springValue(source, options) {
      return followValue(source, { type: "spring", ...options });
  }
  /**
   * Attach a spring animation to a MotionValue that will animate whenever the value changes.
   *
   * @param value - The MotionValue to animate
   * @param source - Initial value or MotionValue to track
   * @param options - Spring configuration options
   * @returns Cleanup function
   *
   * @public
   */
  function attachSpring(value, source, options) {
      return attachFollow(value, source, { type: "spring", ...options });
  }
  
  export { attachSpring, springValue };
  //# sourceMappingURL=spring-value.mjs.map