Motion design is the art of bringing visual elements to life, creating fluid interactions and engaging users through captivating movement.
In this article, we dive into the dynamic world of motion design and explore how Framer Motion simplifies and optimises the creation of animations for user interfaces with React.
What is Motion Design π ?
Motion design (or graphic animation) is the art of creating visual animations to convey emotions and interactions.
From its beginnings in traditional media, it has evolved to become a fundamental element of digital design, with web applications, mobile applications and much more.

Framer Motion, what's that π€?
Created by the Framer team, Framer Motion is a component animation library for the React library.
This JavaScript library offers a declarative approach to creating complex animations, from managing transitions to controlling physical effects, with disconcerting ease.
At Reskue we use this library on our Reskue Tech site and our upcoming V.2 of Reskue art, which will be available soon.
How does it work?
Here's a quick example to illustrate how easy it is to integrate this library.
First, create a new project using Create React App :
npx create-react-app my-framer-motion-app
cd my-framer-motion-app
Then install Framer Motion in your project :
npm install framer-motion
Import "motion" from Framer motion :
import React from 'react';
import { motion } from 'framer-motion';
Next, let's create a displacement animation when our component is loaded :
import React from "react";
import { motion } from "framer-motion";
const App = () => {
return (
<motion.div
initial={{ x: 0 }}
// The 'initial' property defines the initial state of the element before the animation starts.
animate={{ x: 100 }}
// The 'animate' property specifies towards what values the properties should be animated.
transition={{ duration: 1, type: "spring" }}
// The 'transition' property controls the duration and type of animation.
>
Animer moi!
</motion.div>
);
};
export default App;
In this example, when our component is loaded, our div will move from its initial position in the centre to the right.

You can animate absolutely anything with just a few lines of code!
When you hover over a :
import React from "react";
import { motion } from "framer-motion";
const App = () => {
return (
<motion.div
whileHover={{ scale: 1.2 }}
// The 'whileHover' property allows defining animations that trigger when an element is hovered over.
transition={{ duration: 1, type: "spring" }}
>
Animer moi !
</motion.div>
);
};
export default App;

At the click of an element
import React from "react";
import { motion } from "framer-motion";
const App = () => {
return (
<motion.div
transition={{ duration: 1, type: "spring" }}
whileTap={{ scale: 0.5 }}
// The 'whileTap' property allows defining animations that trigger when an element is clicked.
>
Animer moi !
</motion.div>
);
};
export default App;

you can animate virtually any element of your interface.
Whether it's hovering over an element, clicking a button, or even in response to other user interactions.
Framer Motion key features π
Fluid transitions : Framer Motion lets you define fluid transitions between element states by using the "useAnimation" hook to control animations and transitions between component states.
Physical spring effects : With Framer Motion, you can use the "useSpring" hook to create realistic animations with physical spring effects, giving your elements a feeling of natural movement.
Scroll animations : By using Framer Motion's motion.div component in conjunction with the "useViewportScroll" hook, you can create responsive animations based on the scrolling of the page, offering an immersive and interactive user experience.
A few tips to keep in mind π€
Performance: Opt for lightweight animations and avoid overloads that could slow down your application's performance.
Accessibility: Make sure your animations are accessible to all users, offering alternatives for people with visual or motor disabilities.
Responsive design: Think about how your animations will adapt to different devices and screen sizes for a consistent user experience, especially on mobile phones.
Conclusion
Motion design and Framer Motion open up new perspectives in user interface design by creating interactive experiences that captivate and provide a rich user experience.
By combining your creativity with Framer Motion's features, you can bring fluid, elegant interfaces to life.
Dive into the world of motion design and discover the simplicity and potential of Framer Motion to transform your creative ideas into interactive interfaces π
CrΓ©dit : Hasni Fodeilla