heyman333 / react-animated-numbers

👾 Library showing animation of number changes in react.js
MIT License
247 stars 30 forks source link

Conflict with Framer motion container #49

Closed venkatesh1146 closed 12 months ago

venkatesh1146 commented 1 year ago

Hi,

Thank you for the awesome lib. 😄 🍰

I am having an issue while rendering the animated numbers in the framer motion animated container. Currently it is like below https://user-images.githubusercontent.com/115448824/231689346-f18847e3-0912-4aac-8e60-684c51eb78ac.mov

Stack:

Relevant code:

import AnimatedRollingNumber from '@/RollingNumbers';
import { motion } from 'framer-motion';

const zoomOut = {
    hidden: {
        transform: "scale(0.5)",
        opacity: 0,

    },
    visible: {
        transform: "scale(1)",
        opacity: 1,
        transition: {
            duration: 0.2
        }
    },
    exit: {
        transform: "scale(0.5)",
        opacity: 0,
        transition: {
            duration: 0.1
        }
    }
};

export default function Home() {

  return (
    <div style={{height:"100vh",width:"100vw",display:"flex",justifyContent:"center",alignItems:"center"}}>
      <motion.div
        style={{
        border:"1px solid white",
        height:"300px",
        width:"300px",
        display:"flex",justifyContent:"center",alignItems:"center"
        }}
        variants={ zoomOut}
        initial="hidden"
        animate="visible"
        exit="exit">
         <AnimatedRollingNumber amount={45678} />
      </motion.div>
    </div>
  )
}
venkatesh1146 commented 1 year ago

50

heyman333 commented 12 months ago

Updated library to use framer-motion. Please check again.

venkatesh1146 commented 12 months ago

Thank you @heyman333