Design comparison
SolutionDesign
Solution retrospective
This is a ideal simple project for someone want to work with API. It is not to difficult and can practice using animation in CSS.
But I don't know the differences between animation and transition in CSS 😓😕 They confused me when making animation for the Dice button.
Community feedback
- @EileenpkPosted almost 2 years ago
Hi The Nghia,
The differences between animation and transition in CSS are:
- Animation in CSS refers to the creation of motion through a series of keyframe rules
- Animations allow for more complex and customizable motion
- Animations are defined using the @keyframes rule and controlled using the animation property
<div class="square"></div> .square { width: 50px; height: 50px; background-color: red; position: absolute; animation: move-right 2s linear infinite; } @keyframes move-right { from { left: 0; } to { left: 100%; } }
- Transition refers to a simple change in state, such as a hover effect, that occurs smoothly over a set duration.
- Transitions are generally simpler and more limited in scope.
- Transitions are controlled using the transition property.
<button class="my-button">Hover me</button> .my-button { background-color: blue; color: white; padding: 10px; transition: background-color 0.5s ease; } .my-button:hover { background-color: red; }
Hope you found this helpful!
- Let's connect on LinkedIn! - @Eileenpk
Marked as helpful0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord