.shake {
    &:hover,
    &:focus { 
        img {
            animation-name: rotation;
            animation-duration: 0.4s;
            transform-origin: 50% 50%;
            animation-timing-function: linear;
        }
    }
}

@keyframes rotation {
    0% { transform: rotate(0deg); }
    40% { transform: rotate(16deg); }
    88% { transform: rotate(-6deg); }
    100% { transform: rotate(0deg); }
}
