# Ken Burns Effect

> A slow, cinematic zoom-and-pan on a hero image, looping back and forth inside a cropped frame.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: ken burns, slow zoom, pan, hero image, animation, slideshow
- Live preview: https://copy-css.com/snippets/ken-burns-effect
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="ken-burns">
  <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 40'%3E%3Cdefs%3E%3ClinearGradient id='s' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23f472b6'/%3E%3Cstop offset='1' stop-color='%23fdba74'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='60' height='40' fill='url(%23s)'/%3E%3Ccircle cx='42' cy='15' r='7' fill='%23fef08a'/%3E%3Cpath d='M0 40V26l12-8 10 7 9-5 14 9 15-6v17z' fill='%237c3aed'/%3E%3Cpath d='M0 40v-8l16-5 12 4 14-6 18 6v9z' fill='%234c1d95'/%3E%3C/svg%3E" alt="Purple hills under a pink sunset" width="260" height="160">
</div>
```

## CSS

```css
.ken-burns {
  width: 260px;
  height: 160px;
  overflow: hidden;
  border-radius: 14px;
}

.ken-burns img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 70% 40%;
  animation: ken-burns-move 14s ease-in-out infinite alternate;
}

@keyframes ken-burns-move {
  from {
    transform: scale(1) translate(0, 0);
  }

  to {
    transform: scale(1.3) translate(-4%, 3%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ken-burns img {
    animation: none;
  }
}
```

## Notes

- This CSS Ken Burns Effect is 31 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses keyframe animations, transforms and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
