cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <section class="header">
  <h1>Smooth Ken Burns Effect Using the Transition Property</h1>
  <p><a href="http://paulirish.com/2012/why-moving-elements-with-translate-is-better-than-posabs-topleft/">Paul Irish</a> on why translate is better than positioning to move elements. The same is true for a lot of transition values and their counterparts. The first image shows a Ken Burns effect using transition:scale;. The second uses zoom; notice how at the very end of the animation the image is pixel fit, causing a stuttering effect on the bottom.</p>
</section>
<div class="imageWrapper"><div class="image">
  <img src="http://static.squarespace.com/static/4fb50a18e4b0f2fffeb51dda/4fb50a19e4b0f2fffeb51ddf/50255b3184ae111bdb329ce6/1344625457128/sqspc2-1.jpg?format=1500w" />
</div></div>
<div class="imageWrapperZoom"><div class="imageZoom">
  <img src="http://static.squarespace.com/static/4fb50a18e4b0f2fffeb51dda/4fb50a19e4b0f2fffeb51ddf/50255b3184ae111bdb329ce6/1344625457128/sqspc2-1.jpg?format=1500w" />
</div></div>
            
          
!
            
              body {
  margin: 0;
  padding: 0;
  background-color: whitesmoke;
}
.header {
  font-family: Sans-Serif;
  padding: 100px 0;
  text-align: center;
  font-weight: 300;
  border-bottom: 1px solid #DDD;
  h1 {
    font-weight: 400;
    font-size: 1.3em;
  }
  p {
    width: 500px;
    margin: 0 auto;
    line-height: 1.4em;
    margin-bottom: 15px;
  }
}

/* SCALE (USE THIS)
========================================== */
.imageWrapper {
  background-color: #EEE;
  border-bottom: 2px solid #DDD;
  padding: 50px 0;
}
.image {
  width:1200px;
  height:700px;
  margin:0 auto;
  overflow:hidden;
  position: relative;
}
.image img {
  animation:move 7s ease infinite; /* Change this to alternate to stop the loop. */
  -ms-animation:move 7s ease infinite;
  -webkit-animation:move 7s ease infinite;
  -0-animation:move 7s ease infinite;
  -moz-animation:move 7s ease infinite;
  position: absolute;
  left:-150px;
  top:-150px;
}

@-webkit-keyframes move {
  from {
  	transform: scale(0.9);
    -ms-transform: scale(0.9); /* IE 9 */
    -webkit-transform: scale(0.9); /* Safari and Chrome */
    -o-transform: scale(0.9); /* Opera */
    -moz-transform: scale(0.9); /* Firefox */
  }
  to {
  	transform: scale(1.0);
    -ms-transform: scale(1.0); /* IE 9 */
    -webkit-transform: scale(1.0); /* Safari and Chrome */
    -o-transform: scale(1.0); /* Opera */
    -moz-transform: scale(1.0); /* Firefox */
  }
}

/* ZOOM (DON'T USE THIS)
========================================== */
.imageWrapperZoom {
  background-color: #EEE;
  border-bottom: 2px solid #DDD;
  padding: 50px 0;
}
.imageZoom {
  width:1200px;
  height:700px;
  margin:0 auto;
  overflow:hidden;
  position: relative;
}
.imageZoom img {
  animation:zoom 7s ease infinite;
  -ms-animation:zoom 7s ease infinite;
  -webkit-animation:zoom 7s ease infinite;
  -0-animation:zoom 7s ease infinite;
  -moz-animation:zoom 7s ease infinite;
  position: absolute;
  left:-150px;
  top:-150px;
}

@-webkit-keyframes zoom {
  from {
  	zoom: 90%;
  }
  to {
    zoom: 100%;
  }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console