/** based on framer-motion@4.1.17, Copyright (c) 2018 Framer B.V. */ import type { ResolvedValueTarget, Spring, Tween } from '../types'; import type { MotionValue } from '../value/index.js'; /** * @public */ export interface AnimationPlaybackControls { stop: () => void; } /** * @public */ export interface AnimationPlaybackLifecycles { onUpdate?: (latest: V) => void; onPlay?: () => void; onComplete?: () => void; onRepeat?: () => void; onStop?: () => void; } /** * @public */ export type AnimationOptions = (Tween | Spring) & AnimationPlaybackLifecycles & { delay?: number; type?: 'tween' | 'spring'; }; /** * Animate a single value or a `MotionValue`. * * The first argument is either a `MotionValue` to animate, or an initial animation value. * * The second is either a value to animate to, or an array of keyframes to animate through. * * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`. * * Returns `AnimationPlaybackControls`, currently just a `stop` method. * * ```javascript * const x = useMotionValue(0) * * useEffect(() => { * const controls = animate(x, 100, { * type: "spring", * stiffness: 2000, * onComplete: v => {} * }) * * return controls.stop * }) * ``` * * @public */ declare function animate(from: MotionValue | V, to: ResolvedValueTarget, transition?: AnimationOptions): AnimationPlaybackControls; export { animate }; //# sourceMappingURL=animate.d.ts.map