Skip to main content
13 October 2023

SVG with GIF inside. How to freeze the animation?

We discovered that you can place animated GIFs inside of the SVG. This makes freezing animation very interesting problem. Example is on the site Neutec

GIF inside SVG

 

Here is a way to freeze it with javascript:
 

const image = document.querySelector('#Layer_1 image[*|href$=".gif"]');

if (image) {
    const c = document.createElement('canvas');
    const w = c.width = image.getAttribute('width');
    const h = c.height = image.getAttribute('height');

    c.getContext('2d').drawImage(image, 0, 0, w, h);
    image.setAttributeNS('http://www.w3.org/1999/xlink', 'href', c.toDataURL('image/gif'));
}

How to Avoid False Positives when Doing Visual Testing

The biggest pain point of fulll-page screenshot visual regression testing are false positives. They usually happen because of the dynamic nature of the content. There are few ways of handling this situation. First, you could mask or remove dynamic elements completely. But then you’ll miss testing them.
6 mins read read

Diffy helps your QA team

to ensure that websites don't get visual bugs