This file contains hidden or 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
| useEffect(() => { | |
| const timeOut = setTimeout(setCurrentScene, SLIDE_CHANGE_TIME_MS); | |
| return () => clearTimeout(timeOut); | |
| }, [currentScene, setCurrentScene]); |
This file contains hidden or 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
| const [currentScene, setCurrentScene] = useCycle( | |
| hedgehogScene, | |
| raccoonScene, | |
| squirrelScene | |
| ); |
This file contains hidden or 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
| import React from "react"; | |
| import { motion } from "framer-motion"; | |
| const TRANSITION_TIME_OPACITY_S = 1; | |
| const TRANSITION_TIME_ROTATE_S = { MIN: 1.5, MAX: 2.5 }; | |
| function getRandomNumberBetween(min, max) { | |
| return Math.floor(Math.random() * max) + min; | |
| } |
This file contains hidden or 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
| transition={{ | |
| yoyo: Infinity, | |
| duration: 2, | |
| ease: "easeInOut" | |
| }} |
This file contains hidden or 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
| <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }}> | |
| <span>This text will fade in when created in the DOM</span> | |
| </motion.div> |
This file contains hidden or 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
| import React from "react"; | |
| import { motion, AnimatePresence } from "framer-motion"; | |
| const ANIMATION_DURATION_S = 0.8; | |
| const getVariants = (direction) => ({ | |
| initial: { | |
| y: direction === "top" ? "-100%" : "100%", | |
| opacity: 0, | |
| transition: { duration: ANIMATION_DURATION_S, ease: "easeInOut" }, |
This file contains hidden or 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
| import React from "react"; | |
| import { motion, AnimatePresence } from "framer-motion"; | |
| const ANIMATION_DURATION_S = 0.8; | |
| function IconHolder({ icon, text }) { | |
| return ( | |
| <div className="icon-holder"> | |
| <AnimatePresence> | |
| <motion.div | |
| className="icon-holder__icon" |
This file contains hidden or 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
| import React from "react"; | |
| import { motion, AnimatePresence } from "framer-motion"; | |
| const TRANSITION_TIME_OPACITY_S = 1; | |
| const TRANSITION_TIME_ROTATE_S = { MIN: 1.5, MAX: 2.5 }; | |
| function getRandomNumberBetween(min, max) { | |
| return Math.floor(Math.random() * max) + min; | |
| } |
This file contains hidden or 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
| import React, { useEffect } from "react"; | |
| import { useCycle } from "framer-motion"; | |
| import ImageHolder from "./ImageHolder"; | |
| import IconHolder from "./IconHolder"; | |
| import { hedgehogScene, raccoonScene, squirrelScene } from "./scenes"; | |
| const SLIDE_CHANGE_TIME_MS = 5000; |
This file contains hidden or 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
| import React from "react"; | |
| import { motion } from "framer-motion"; | |
| const TRANSITION_TIME_OPACITY_S = 1; | |
| const TRANSITION_TIME_ROTATE_S = 2; | |
| function ImageHolder({ img, className }) { | |
| return ( | |
| <motion.div | |
| initial={{ opacity: 0 }} |
NewerOlder