cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <div class="container">
  <div class="box box1">fromTo</div>
  <div class="box box2">fromTo</div>
  <div class="box box3">to</div>
</div>

<button>Run Animation</button>
            
          
!
            
              body {
  background-color: #222;
  overflow: hidden;
}

.container {
  width: 650px;
  margin: auto;
  position: relative;
}

.box {
  width: 150px;
  height: 150px;
  position: absolute;
  top: 40px;
  color: #fff;
  font-size: 25px;
  line-height: 150px;
  text-align: center;
  font-family: sans-serif;
  font-weight: bold;
  border-radius: 10px;
}

.box1 {
  left: 50px;
  background-color: #333;
}
.box2 {
  left: 250px;
  background-color: #673ab7;
}
.box3 {
  left: 450px;
  background-color: #e91e63;
}

button {
  backgrund: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  position: relative;
  top: 300px;
  transition: .5s all;
  display: block;
  margin: auto;
  padding: 10px;
}

button:hover {
  background: #999;
}

            
          
!
            
              // identify elements
var el1 = document.querySelector(".box1");
var el2 = document.querySelector(".box2");
var el3 = document.querySelector(".box3");

// build tween objects for element1
var tween11 = KUTE.fromTo(
  el1,
  { translateX: 0, rotateX: 0 },
  { translateX: 100, rotateX: 25 },
  { perspective: 100, duration: 2000 }
);
var tween12 = KUTE.fromTo(
  el1,
  { translateY: 0, rotateY: 0 },
  { translateY: 20, rotateY: 15 },
  { perspective: 100, duration: 2000 }
);
var tween13 = KUTE.fromTo(
  el1,
  { translate3d: [100, 20, 0], rotateX: 25, rotateY: 15 },
  { translate3d: [0, 0, 0], rotateX: 0, rotateY: 0 },
  { perspective: 100, duration: 2000 }
);

// build tween objects for element2
var tween21 = KUTE.fromTo(
  el2,
  { translateX: 0, translateY: 0, rotateX: 0, rotateY: 0 },
  { translateX: 100, translateY: 0, rotateX: 25, rotateY: 0 },
  { perspective: 100, duration: 2000 }
);
var tween22 = KUTE.fromTo(
  el2,
  { translateX: 100, translateY: 0, rotateX: 25, rotateY: 0 },
  { translateX: 100, translateY: 20, rotateX: 25, rotateY: 15 },
  { perspective: 100, duration: 2000 }
);
var tween23 = KUTE.fromTo(
  el2,
  { translate3d: [100, 20, 0], rotateX: 25, rotateY: 15 },
  { translate3d: [0, 0, 0], rotateX: 0, rotateY: 0 },
  { perspective: 100, duration: 2000 }
);

// build tween objects for element3
var tween31 = KUTE.to(
  el3,
  { translateX: 100, rotateX: 25 },
  { perspective: 100, duration: 2000 }
);
var tween32 = KUTE.to(
  el3,
  { translate3d: [100, 20, 0], rotateY: 15 },
  { perspective: 100, duration: 2000 }
);
var tween33 = KUTE.to(
  el3,
  { translate3d: [0, 0, 0], rotateX: 0, rotateY: 0 },
  { perspective: 100, duration: 2000 }
);

// trigger animations
document.querySelector("button").addEventListener("click",
  function() {
    tween11.start();
    tween11.chain(tween12);
    tween12.chain(tween13);
    
    tween21.start();
    tween21.chain(tween22);
    tween22.chain(tween23);
    
    tween31.start();
    tween31.chain(tween32);
    tween32.chain(tween33);
  },
  false
);
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console