Home > Blockchain >  Keyframe animation won't go back smoothly
Keyframe animation won't go back smoothly

Time:05-02

Hovering over nav button animates smoothly, on cursor leaving button animation doesn't go back smooth.

._2tMl3Z {
    font-family: SangbleuSans,Helvetica,Arial,sans-serif;
    line-height: 1em;
    font-weight: 500;
    font-size: 15px;
    font-size: 1vw;
    position: absolute;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background-image: url(https://cdn.shopify.com/s/files/1/0610/0471/0048/files/logo.png?v=1651172361);
    background-size: cover;
    background-repeat: no-repeat;
    background-color: transparent;
    color: rgb(0, 0, 0);
    line-height: 17px;
    letter-spacing: .1em;
    text-transform: uppercase;
    border-radius: 50%;
    -webkit-transform: translateY(0);
    transform: translateY(0);
    transition: -webkit-transform .2s cubic-bezier(.165,.84,.44,1);
    transition: transform .2s cubic-bezier(.165,.84,.44,1);
    transition: transform .2s cubic-bezier(.165,.84,.44,1),-webkit-transform .2s cubic-bezier(.165,.84,.44,1);
    cursor: pointer;
    transition-duration: 1s;
    border: solid 0 transparent;

}



._2tMl3Z:hover {
    font-family: SangbleuSans,Helvetica,Arial,sans-serif;
    line-height: 1em;
    font-weight: 500;
    font-size: 15px;
    font-size: 1vw;
    position: absolute;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    width: 60px;
    height: 60px;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: transparent;
    color: rgb(0, 0, 0);
    line-height: 17px;
    letter-spacing: .1em;
    text-transform: uppercase;
    border-radius: 50%;
    cursor: pointer;
    transition-duration: 500ms;
    animation: bg 300ms ease-out forwards;


}

@keyframes bg {
  

   100% { background-image: url(https://cdn.shopify.com/s/files/1/0610/0471/0048/files/color-glow.png?v=1651334671);}
    
    100% { margin-top: 5px;}
}

._2chqNa {
    width: 84px;
    height: 84px;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    position: absolute;
    margin: auto;
    overflow: visible;
    overflow: initial;
    opacity: 1;
    transition: opacity .35s ease-out;
}
._14aBMl {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
}
._2BBz_8, ._14aBMl {
    fill: transparent;
    -webkit-transform-origin: 50% 50%;
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s linear;
}

._2tMl3Z span {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 55px;
    margin-left: 2px;
        letter-spacing: 2px;
    transition-duration: 500ms;
    background: linear-gradient(90deg, rgba(244,71,112,255) , rgba(73,93,243,255));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 0px 4px rgba(0,0,0,0.21) !important;
    

   /*  background: linear-gradient(90deg, rgb(255, 0, 162) , rgb(129, 4, 238));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    */

}

._2tMl3Z:hover span {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    margin-bottom: 55px;
    font-size: 10px;
    margin-left: 2px;
    font-weight: 600;
    letter-spacing: 2px;
    color: white;
    

}

Codepen

CodePudding user response:

Use "ease-in-out" instead of "ease-out"

animation: bg 300ms ease-in-out forwards;

CodePudding user response:

What is the opposite of :hover (on mouse leave)?

:not

is meant for after leaving hover

example

li:not(:hover) {
    color: grey;
    transition: all 2s;
} 
  • Related