, . .
:
top: 150px hover of div a top: 0. transition: top .5s top: 0; top: 150px;, .
translateY(-60px); , , animation.
CSS:
div {
width: 200px;
height: 200px;
margin: 40px auto;
background-color: #b00;
position: relative;
&:hover {
span {
top: 0px;
animation: rotate 1s infinite .5s alternate;
animation-direction: alternate;
}
}
}
span {
position: absolute;
width: 20px;
height: 20px;
background-color: #fff;
bottom: 10px;
left: 0;
right: 0;
top: 150px;
margin: auto;
transition: top .5s;
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(-90deg);
}
}
: , , , , , , keyframes . Hover-in hover-out , , , ( , ) . transition , , , (, :hover). :hover , 5 , top:0, , 5 , top:150px.
, :)
, animation-name: .., .