CSS Animation Example: The Ken Burns Effect

The "Ken Burns Effect" is a cinematic tracking technique involving a slow, continuous pan and zoom across a static image, famously popularized by the documentary filmmaker.

Explore the Wild

To pull this off effectively on a website block (like a hero banner), structure is everything. You need a parent container with fixed dimensions and overflow: hidden to prevent the zooming image from bleeding out.

The image itself is usually applied as a background-image with background-size: cover to ensure it fits nicely regardless of screen ratio. We then apply an exceptionally long animation-duration (e.g., 15s) with an alternate direction. Inside the @keyframes, we simply drift the transform: scale() value slowly upwards to around 1.2 while providing a subtle X/Y pixel translation to simulate the panning of a camera head.

Here is the code to create The Ken Burns Effect.

View Output

Accessibility Considerations

While elegant, persistent background motion covering large areas of the screen is a common trigger for vestibular motion distress. prefers-reduced-motion is a CSS media feature used to detect if a user has enabled a setting on their device to minimize the amount of non-essential animation or motion.

Because the image itself is the primary decorative element, if a user has indicated they prefer reduced motion, you should leave the image but forcibly disable the ken-burns animation block.

Here's what we used in our example:


@media (prefers-reduced-motion: reduce) {
    .kb-image {
        /* Disables the zoom/pan, leaving a beautiful static background */
        animation: none; 
    }
}