framer-motion#Variants TypeScript Examples

The following examples show how to use framer-motion#Variants. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PrimaryNavigation.tsx    From chroma-react with MIT License 7 votes vote down vote up
SHARED_TRANSITION_VARIANTS: Variants = {
  hide: { opacity: 0 },
  show: {
    opacity: 1,
    transition: {
      duration: 0.3,
    },
  },
}
Example #2
Source File: ContextMenuList.tsx    From wiregui with MIT License 6 votes vote down vote up
motionVariants: Variants = {
  enter: {
    visibility: "visible",
    opacity: 1,
    scale: 1,
    transition: {
      duration: 0.1,
      ease: [0.4, 0, 0.2, 1],
    },
  },
  exit: {
    transitionEnd: {
      visibility: "hidden",
    },
    opacity: 0,
    scale: 0.8,
    transition: {
      duration: 0.1,
      easings: "easeOut",
    },
  },
}
Example #3
Source File: PrimaryNavigation.tsx    From chroma-react with MIT License 6 votes vote down vote up
NAV_LIST_TRANSITION_VARIANTS: Variants = {
  hide: {},
  show: {
    transition: {
      staggerChildren: 0.04,
      delayChildren: 0.125,
    },
  },
}
Example #4
Source File: PrimaryNavigationExpansionItem.tsx    From chroma-react with MIT License 5 votes vote down vote up
BASE_TRANSITION_VARIANTS: Variants = {
  hide: { opacity: 0, x: 16, transition: { ease: 'easeIn' } },
  show: { opacity: 1, x: 0, transition: { ease: 'easeOut' } },
}
Example #5
Source File: AnimatedLetters.tsx    From plasmic with MIT License 5 votes vote down vote up
export default function AnimatedLetters({
  className,
  text = "Enter some text",
  stagger = 0.01,
  initial = {
    opacity: 0,
    y: "100%",
  },
  visible = {
    opacity: 1,
    y: 0,
    transition: {
      ease: "easeOut",
    },
  },
  exit = {
    opacity: 0,
    y: "-100%",
  },
}: AnimatedLettersProps) {
  const letterVariants: Variants = {
    initial: initial,
    visible: (i) => ({
      ...visible,
      transition: {
        ...visible?.transition,
        delay: (visible?.transition?.delay ?? 0) + i * stagger,
      },
    }),
    exit: (i) => ({
      ...exit,
      transition: {
        ...exit?.transition,
        delay: (exit?.transition?.delay ?? 0) + i * stagger,
      },
    }),
  };

  return (
    <motion.div
      className={className}
      initial="initial"
      animate="visible"
      exit={"exit"}
    >
      {text.split("").map((letter, i) => (
        <motion.span
          key={i}
          custom={i}
          style={{ display: "inline-block" }}
          variants={letterVariants}
        >
          {letter === " " ? "\u00a0" : letter}
        </motion.span>
      ))}
    </motion.div>
  );
}