So, I have an image:
I'd like to rotate it on hover, to give the illusion of the squares animating different colours. However, I had to settle for:
.logo:hover {
transform: rotate(90deg);
}
As if I used animation
and keyframes with % step, you could physically see the logo rotate, I'd like it to snap to the next deg
value, if possible. How could I do this infinitely on hover?
You can use the timing-functions steps ,
@-webkit-keyframes rotate {
from {
-webkit-transform: rotate(0deg);
}
to {
-webkit-transform: rotate(360deg);
}
}
.logo:hover {
-webkit-animation: rotate 1s infinite steps(2, start);
}
https://developer.mozilla.org/en/docs/Web/CSS/timing-function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.