Files
SnowLuma/.pnpm-store/v11/files/4b/4148e75682cad7b886f9bddb7ff2f8fddcf60d3896cebb9bec89a08a4282db4b92b8e5e8b7a50a1d7d5affcd8169be0a33e4c6852a702ef3004b1cc867bcf4
TanTan 2a69b23b47
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

37 lines
1.0 KiB
Plaintext

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