<div id="root"></div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  line-height: 1.5;
  font-size: 15px;
  font-weight: 400;
}

body {
  width: 100vw;
  min-height: 100vh;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;

  font-family: "Exo", Arial, sans-serif;
  background-color: #151522;
  color: #fff;
}

#root {
  display: flex;
  justify-content: center;
  align-items: center;
}

.box {
  min-width: 30vh;
  aspect-ratio: 1/1;
  background-color: #f36;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  font-size: 1.2rem;
}
const { motion } = Motion;

const variant = {
  active: {
    rotate: 90,
    scale: 1.5,
    opacity: 1
  },
  inactive: {
    rotate: 0,
    scale: 1,
    opacity: 0.75
  }
};

const App = () => {
  const [isActive, setIsActive] = React.useState(false);

  return (
    <motion.div
      className="box"
      onClick={() => setIsActive(!isActive)}
      variants={variant}
      animate={isActive ? "active" : "inactive"}
    >
      Click Me (^_^) !{" "}
    </motion.div>
  );
};

ReactDOM.render(<App />, document.getElementById("root"));
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/react/17.0.1/umd/react.production.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.1/umd/react-dom.production.min.js
  3. https://unpkg.com/framer-motion@1.6.7/dist/framer-motion.js