motiondivision / motiondivision/motion
[FEATURE] Support for ref elements in sequences
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 33.7k
- Forks
- 1.4k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 14
Description
problem
I cannot animate elements in an animation sequences referenced by ref using simple animate() function, only selectors and motion values
const intro = {
progress: motionValue(0),
openVert: motionValue(0),
openHor: motionValue(0),
sectionRef: useRef<HTMLDivElement>(null!),
progressRef: useRef<HTMLDivElement>(null!),
progressBarRef: useRef<HTMLDivElement>(null!),
serviceRef: useRef<HTMLParagraphElement>(null!),
}
const introSeq: AnimationSequence = [
[intro.serviceRef.current, { opacity: 0 }, { duration: 0.5, at: 0.5 }],
[intro.progress, 1, { duration: 1, ease: 'circIn' }], //only this will animate
[intro.progressBarRef.current, { height: '100vh' }, { delay: 0.2 }],
[intro.progressBarRef.current, { width: '100vw' }],
[intro.sectionRef.current, { opacity: 0 }, { duration: 1 }],
]
useEffect(() => {
animate(introSeq) //from 'framer-motion' for sure...
}, [])
I assume, you absolutely can add refs, not only selectors and motions values. I hope it is not a bug or I am simply using this function in a wrong way thus refs are not working only for me. 💘
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the animate() API and the AnimationSequence usage shown in the issue, then trace how sequence targets are resolved. Done means refs such as intro.serviceRef.current and intro.progressBarRef.current can animate in the sequence alongside motion values and selectors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100