-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf70dbf
commit c4a5226
Showing
3 changed files
with
5,375 additions
and
2,557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,45 @@ | ||
import React from 'react' | ||
import { motion } from 'framer-motion' | ||
import React from "react"; | ||
import { motion } from "framer-motion"; | ||
|
||
const container = { | ||
visible: { | ||
enter: { | ||
transition: { | ||
when: 'beforeChildren', | ||
staggerChildren: 0.1, | ||
when: "beforeChildren", | ||
staggerChildren: 0.3, | ||
}, | ||
}, | ||
} | ||
}; | ||
const item = { | ||
hidden: { y: 20, opacity: 0 }, | ||
visible: { | ||
initial: { y: 20, opacity: 0 }, | ||
enter: { | ||
y: 0, | ||
opacity: 1, | ||
}, | ||
} | ||
}; | ||
|
||
const AnimatedPage = () => ( | ||
<> | ||
<h1>Animated On Page Mount</h1> | ||
<motion.ul variants={container} initial="hidden" animate="visible"> | ||
<motion.li variants={item}>Lorem Ipsum</motion.li> | ||
<motion.li variants={item}>Dolor Set</motion.li> | ||
<motion.li variants={item}>Amet</motion.li> | ||
<h1>Animated After Page Mount</h1> | ||
<p> | ||
As mentioned on{" "} | ||
<a | ||
href="https://github.com/framer/motion/issues/294#issuecomment-629353859" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
framer/motion#294 | ||
</a>{" "} | ||
the child variant keys need to be named the same as the parent variant | ||
keys. This may change in the future but just something to be aware of.{" "} | ||
</p> | ||
<motion.ul variants={container}> | ||
<motion.li variants={item}>I am</motion.li> | ||
<motion.li variants={item}>staggered content</motion.li> | ||
<motion.li variants={item}>that animates in</motion.li> | ||
<motion.li variants={item}>after the initial</motion.li> | ||
<motion.li variants={item}>page fade</motion.li> | ||
</motion.ul> | ||
</> | ||
) | ||
); | ||
|
||
export default AnimatedPage | ||
export default AnimatedPage; |
Oops, something went wrong.