I've just discovered how to animate elements using the transform property (looks amazing!). I'm running into a bit of trouble with the ease-out part though. As in when I take my mouse off the element it drops back to its original state instantaneously - I'd like to apply the same animation time on the way back down if possible.
The code:
<div class="transform-box">
</div>
.transform-box:hover {
animation: raise 2s; }
@keyframes raise {
0% {
transform: translateY(0); }
100% {
transform: translateY(-150px); }
}
Am I doing this the right way? Or should I be using different properties if I want an equal animation time on it's way up and on it's way back down?
Edit: An example is here: https://www.lonelyplanet.com/france/paris - scroll to the second section where it says 'Top experiences in Paris - is this something achievable with only CSS or does it require Javascript?
I looked at the possible duplicate question and it seems that the answer is only halfway there - it can manage the animation time back to the original state however if the mouse is moved away from the object then it jumps back.
Thanks,
Reskk