UNPKG

framer-motion

Version:

A simple and powerful JavaScript animation library

18 lines (15 loc) 568 B
import { observeTimeline } from 'motion-dom'; import { getTimeline } from './utils/get-timeline.mjs'; function attachToAnimation(animation, options) { const timeline = getTimeline(options); return animation.attachTimeline({ timeline: options.target ? undefined : timeline, observe: (valueAnimation) => { valueAnimation.pause(); return observeTimeline((progress) => { valueAnimation.time = valueAnimation.duration * progress; }, timeline); }, }); } export { attachToAnimation };