[FEATURE] Headless animations
See original GitHub issueIs your feature request related to a problem? Please describe.
Currently animations require a motion
component. Being able to drive these independently would be useful for a number of reasons, like animating non motion
components, animate with custom interpolators like flubber
, etc.
Describe the solution you’d like Something along the lines of:
useAnimation(
({ height }) => {
// Freedom to do:
heightMotionValue.set(height)
// Or:
setHeightState(height)
// Or:
componentCallback(height)
},
isOpen ? { height: 100 } : { height: 0 }
)
Describe alternatives you’ve considered
We have a useAnimatedState
experimental hook but it’s limited to just React state. Hopefully this feature will superceed this. We have useSpring
but it’s just a single MotionValue
. This feature shouldn’t rely on anything else, offering a function to deal with the output with motionvalues, states, anything.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Headless Studio
Headless Productions is a small independent animation studio founded by Adrian Garcia, Victor Maldonado and Alfredo Torres ...
Read more >140 HEADLESS PRODUCTIONS ideas | character design, ...
May 1, 2018 - Explore PatCompa's board "HEADLESS PRODUCTIONS", ... Flooby Nooby: Visual Development from the animated feature “My Family and the Wolf” ......
Read more >52 Headless Lottie Animations - Free in JSON, LOTTIE, GIF
Download 52 Headless Lottie Animations for free or premium in JSON, LOTTIE, GIF, AEP or MP4 formats. Bring motion to your designs or...
Read more >"Headless Over Heels" by Anna Choi, Cynthia Ma | CGMeetup
CGI 3D Animated Short Film: Headless Over Heels Animated Short Film by ... We feature a wide variety of CGI content including behind-the- ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cloudratha Thanks a lot, I couldn’t wrap my head around this problem.
I had some issues with the transform(value, [0, 1], [0, 1]) part of your solution -> I assumed here you meant useTransform(value, [0, 1], [0, 1]), maybe I was wrong.
Instead of it I just did:
The rest is the same. Thanks, again!
Also, I completely agree with your suggestion of useTween and I don’t like the lack of support for this issue, and other similar ones (https://github.com/framer/motion/issues/218, https://github.com/framer/motion/issues/329).
I’ve just run into needing this feature. I was able to use existing hooks to integrate with flubber.
It would be much easier to have a
useTween
for this example as i need to clamp the values withtransform
. Also having access to duration wouldn’t hurt either.With
useAnimation
do you get access to the individualMotionValue
’s for each entry, to better control the above?