How to Create the Ken Burns Pan & Zoom Effect in Pure CSS

The Quick Answer

The Ken Burns effect imparts slow, cinematic panning and zooming onto still photographs. In pure CSS, wrap the image in an overflow: hidden container and animate transform: scale(1.15) translate(x, y) over a 15–25 second duration with animation: kenBurns 20s ease-out infinite alternate. Setting transform-origin to specific focal coordinates (e.g. top left or bottom right) steers the viewer's gaze naturally across the image.

Interactive Demo Live Preview
Ken Burns Cinematic Pan & Zoom
MAJESTIC LANDSCAPE PAN
transform: scale(1.22) translate3d() · 60 FPS

Step 1: Container Setup: overflow: hidden & Fixed Aspect Ratio

To prevent zooming images from spilling outside their layout boundaries, wrap the target image inside a fixed or responsive container styled with overflow: hidden.

ken-burns-layout.html
<div class="ken-burns-frame">
  <img src="architectural-hero.jpg" alt="Cinematic hero photo" class="ken-burns-img">
</div>

<style>
.ken-burns-frame {
  position: relative;
  width: 100%;
  height: 480px;
  overflow: hidden;
  border-radius: 12px;
}
</style>

Step 2: Hardware-Accelerated Keyframes: scale() & translate()

Never animate top, left, width, or height, as these trigger costly browser reflows. Animate exclusively with transform: scale() translate3d() to ensure the GPU handles all motion on composite layers.

ken-burns-keyframes.css
.ken-burns-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  animation: kenBurnsPanZoom 20s ease-in-out infinite alternate;
}

@keyframes kenBurnsPanZoom {
  0% {
    transform: scale(1.0) translate3d(0, 0, 0);
    transform-origin: center center;
  }
  100% {
    transform: scale(1.18) translate3d(-20px, -15px, 0);
    transform-origin: top left;
  }
}

Step 3: Steering Focal Direction with transform-origin

Different photographs require different focal storytelling: portraits benefit from zooming toward the eyes (top center), while landscapes often pan from horizon (bottom left) to sky (top right).

focal-variations.css
/* Variation A: Zooming In on Subject */
.zoom-in {
  animation: zoomIn 18s ease-out infinite alternate;
  transform-origin: 65% 35%; /* Face coordinates */
}

/* Variation B: Slow Pan Across Landscape */
.pan-right {
  animation: panRight 22s ease-in-out infinite alternate;
}

@keyframes panRight {
  0% { transform: scale(1.12) translate3d(-3%, 0, 0); }
  100% { transform: scale(1.12) translate3d(3%, 0, 0); }
}

Step 4: Cross-Fading Multi-Slide Hero Galleries

Create documentary-style multi-image hero banners by layering multiple images with staggered animation delays and smooth cross-fading opacity keyframes.

slideshow-fade.css
.slide-1 { animation: slideFade 16s infinite 0s; }
.slide-2 { animation: slideFade 16s infinite 8s; }

@keyframes slideFade {
  0%   { opacity: 0; transform: scale(1.0); }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.15) translate3d(-10px, -10px, 0); }
}

Next-Level Addons: Elevating Your Implementation

Take this technique further by combining it with complementary design token studios and animation tools:

Motion: Pan Zoom Alternate 60 FPS GPU

1. CSS Image Ken Burns Animator

Explore in Ken Burns Studio →

Create cinematic pan-and-zoom motion effects for website hero sections, photo galleries, and card backgrounds in pure CSS.

Frame Time: 0.4ms (Zero Jank)

2. Sub-Millisecond Jank Auditing in Animation Auditor

Explore in Animation Auditor →

Audit that slow Ken Burns pan-and-zoom keyframes retain GPU composite layer optimization without layout reflows.

35mm Film Grain Overlay Pulp Texture

3. Atmospheric Noise in Noise Studio

Explore in Noise Studio →

Overlay 35mm cinematic film grain on top of panning documentary photography for authentic historic texture.

Chaam
Chaam's Pro Tip

When building high-performance UI animations or particle systems, my golden rule is: never calculate layout triggers (like getBoundingClientRect() or offsetHeight) inside animation loops. Read measurements once upfront and use CSS transforms or Canvas for buttery 60fps.

Why I Built the CSS Image Ken Burns Animator Studio

I got tired of guessing values and testing browser quirks in DevTools, so I built this tool to tweak and preview values in real time with 1-click code export.

Open in CSS Image Ken Burns Animator ↗

Frequently Asked Questions

Practical answers to common implementation questions, browser quirks, and performance tips.

Who was Ken Burns and why is this effect named after him?

Ken Burns is an acclaimed American documentary filmmaker (known for *The Civil War* and *Baseball*). To bring archival still photography to life on television, he slowly panned and zoomed his camera over historical photographs to guide the viewer's narrative focus.

Why should I avoid using scale values greater than 1.25 in CSS?

Scaling a raster image beyond 1.25x (125%) can cause visible pixelation or softness. A scale range of `1.05` to `1.20` provides ample cinematic movement while keeping photography crisp on high-DPI displays.

How does will-change: transform optimize slow Ken Burns animations?

Declaring `will-change: transform` prompts the browser engine to promote the image to its own dedicated GPU composite layer ahead of time, preventing sub-pixel stutter during slow 20-second animations.

How should I handle prefers-reduced-motion for the Ken Burns effect?

Slow continuous movement can cause nausea for vestibular disorder users. Always include `@media (prefers-reduced-motion: reduce) { .ken-burns-img { animation: none; transform: none; } }`.

Can Ken Burns animations cause high battery consumption on mobile devices?

Because `transform` is animated on the GPU rather than repainting the DOM with CPU cycles, battery consumption is minimal compared to JavaScript-driven animation loops.

← Back to all blog guides Launch Generator Studio →