I do a spinner and instead of making separate images in Photoshop or wherever I set a radial background gradient over the image using the selector :before
-webkit-radial-gradient(center, ellipse cover,
allows the center of the duplicate below to show (not animated) which is positioned by duplicating the img element and setting its position identical to the existing one using Javascript
function spinBadge() { hovered = document.querySelector('a:hover img') spinner = document.createElement('img'); spinner.src = hovered.src; spinner.className = 'spinner'; spinner.setAttribute('width','120px'); spinner.setAttribute('height','120px'); spinner.setAttribute('style','border:0; margin:0; max-width: none; position: absolute; pointer-events: none; left: '+hovered.offsetLeft+'px; top: '+hovered.offsetTop+'px;'); hovered.parentNode.appendChild(spinner); setTimeout(function(){document.querySelector('.spinner').className = 'spinner wheee'}) setTimeout(function(){document.querySelector('.wheee').remove();},3000); }
There are many ways to βcropβ all images by simply changing the margins, etc., and allowing the parts to show selectively.
SVG images are also good for animating, and classes can be assigned to individual sections and thus animated with CSS transitions. There are a lot of similar CSS tricks on this site, if you give it Google ( it will remind).
source share