NDS Site Optimizations
Review of key front-end performance, efficiency, and accessibility aspects of NDS-built sites, highlighting potential improvements and optimized implementations.
-
Site: TrumpCard.gov
Issue: The eagle animation at the bottom appears to cycle 165
.webpimages(2.6 MB)via JavaScript, with the head separate from the body. On Safari, images continue loading even when you scroll away, increasing bandwidth and document requests. Chrome and Firefox do not show this behavior.Efficient Solution: For better performance and reduced code and asset complexity, the same effect can be achieved with a single animated
.webp (2.1 MB)or.webm (514 KB). This removes the JS frame cycling, reduces network requests, and preserves transparency. Safari has limited support for transparent video, so an animated.webpis the safest option currently.Demo: The demo uses a single
.webpfor the eagle head animation and requires no JS. Note that the brown feathers have the same slight color shift as the original assets. -
Site: Freedom.gov
Issue: Based on the markup and behavior, the
.mp4horse animation appears to use a<canvas>layer to remove the black background and create transparency. If so, each frame is probably being decoded and processed through a canvas/WebGL pipeline rather than relying on the browser's native video compositing. The video also contains both color and white versions of the horse animation, likely to help the canvas/WebGL layer achieve the transparent effect.Efficient Solution: For better performance and reduced code and asset complexity, the same visual effect could be achieved using an animated
.webpor optimized.mp4with CSSmix-blend-mode, removing the need for a canvas layer. This lets the browser handle decoding and compositing natively, reducing file size, runtime complexity, and sustained GPU overhead.Demo: The animation on the left shows the
.webp (112KB)version and the animation on the right shows the.mp4 (134KB)version, with both usingmix-blend-mode. As comparison, the.mp4on the current site is280KB.Note that following this approach while using the original assets would ensure color accuracy, and possibly remove the need for
mix-blend-modeif they already have a transparent background.