@legion40216
Posted
Well done bro, love the use of the scale animation and the opacity transitions it bring it to life, could u explain the animation you used in this app i would like to try some of the myself :)
@markteekman
Posted
Thanks @legion40216! 😃 I'm happy to explain, here's how I did this:
I'm setting the initial CSS properties of what will be added inside these div
's:
<div class="player__choice"></div>
<div class="computer__choice"></div>
To this:
[class*="__choice"] > * {
opacity: 0;
transform: scale(2);
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}
And whenever the user initiates a game I use the following JavaScript to change the CSS properties, including a setTimeout
function to add the delay in animations:
setTimeout(() => {
playerChoiceDisplay.firstElementChild.style.opacity = '1'
playerChoiceDisplay.firstElementChild.style.transform = 'scale(1)'
}, 500)
setTimeout(() => {
computerChoiceDisplay.firstElementChild.style.opacity = '1'
computerChoiceDisplay.firstElementChild.style.transform = 'scale(1)'
}, 1000)
Hope this helps 🙂
PS: I really like your take on it by adding that "Best of three" at the top!
@legion40216
Posted
Kudos bro thank you for the help, keep up the impressive work.