See this issue: framer/motion#493. Copy link amcc commented Apr 24, 2020. Fixed it and the have updated the repo and sandbox site with the changes, all working now. To do this yourself add this kind of thing to your gatsby-browser.js: import. When using framer-motion, all used animations are lagging on Firefox, even the ones from the Example page.I've tried it on Chromium and saw no issue whatsoever in a laggy animation. FPS also seem fine (28-30fps). Even tho you require a CodeSandbox for reproduction, it's not actually needed, as this also happens with the Examples on the Framer Motion page (or Docs).
For the launch of Framer's animation API, Benjamin den Boer released a project with 30 example animations. And later, he shared 20 Framer Motion examples.
- # Examples # Gesture animations. Motion provides whileHover and whileTap helper props, that will temporarily animate a component to. Motion uses MotionValue s to track the state and velocity of every animating value. # Viewport scroll. The useViewportScroll hook.
- Hey gang - welcome to your first Frame Motion (for React) tutorial. In this tutorial I'll explain what Framer Motion is and what you'll need to know already.
- All course files for the Framer Motion & React tutorial series on The Net Ninja YouTube channel.
I took those animations and translated them into different versions:
- I made Framer Motion versions of the original code components,
- recreated the Framer Motion animations as code components,
- and also made an overrides version of each animation.
Here's my remix Oxygen xml editor 17 1 download free. of Benjamin's examples: all the animations together (with a few exceptions) in those three formats.
Framer Motion React
Thanks to Framer Motion, we can now include animations in webpages. So each page contains a live example, like this one:
Some animations are triggered by a mouse hover, like the whileHover
example below. These don't work on touch devices, so when you're on a phone or tablet, you'll see a GIF instead of the live animation.
Differences between the versions
The code component version will contain Frames, the Framer Motion version Motion Divs, and the version using overrides will work with what's drawn on the canvas.
Code component
Here's that first animation again, as a code component based on a :
In the examples on the next pages, I'll omit the import
s at the top. Those are often the same anyway, and you can always check out the entire code in the .tsx
file.
Framer Motion
The Framer Motion examples are included in the Framer project, as code components that use s. And there's also a CodeSandbox version of each animation.
Dropshare 5 1 5 ml. A motion.div doesn't have all the fancy properties of a frame, so you'll have to set its CSS properties on style
, like you would with any other div.
But at the same time, a motion.div
does have animate
, transition
, drag
, etc. These extra properties make the animation magic work.
A motion.div
doesn't have a frame's handy center
property, so most examples are wrapped in a
Here it is. It's just a Flexbox
Framer Motion Vs React Spring
Importing the motion library
The motion
component is part of the Framer library, so that's how I import it in the examples:
But when using motion elements on the web, you'll have to get it from the Framer Motion library:
Page and scroll
Framer Motion doesn't have a page component, so I couldn't recreate the examples that use it: 14, 15, 16, and 19.
And it doesn't have a scroll component either. But a motion.div can be made draggable, so it's easy to create a scrollable div that has the same inertia animations as Framer's component. (Examples 17, 18, 20, and 35)
Overrides
The overrides version will almost always be the shortest one, simply because the frame or div doesn't need to be drawn. (It already exists on the canvas.)
Things get a bit more complicated when there's more than one frame because you'll then have to use a data object to communicate between different overrides. (Although sometimes a motionValue()
suffices.)
But when there are many frames, it's often not worth it. I didn't even try to recreate examples 35 and 36 because it would result in even more code than the Framer Motion and code component versions.