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 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.

              <div class="rectangle">
  <div class="p1"></div>
  <div class="p2"></div>
  <div class="p3"></div>
  <div class="p4"></div>
Setup @keyframes sets to move the first three shapes (.p1, .p2, and .p3) in random orders and have the square shape (.p1) be the only shape left over.

Infinite Chocolate: http://youtu.be/liI7rm5o1Rc

$bezier-shape: cubic-bezier(.4,.2,0,1);

html,body { height: 100%; }

body { perspective: 1000px; }

.rectangle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 614px;
  transform: translate3d(-50%,-50%,0);
  transform-style: preserve-3d;

  .p1 {
    position: absolute;
    background-color: brown;
    height: 100px;
    width: 100px;
    animation: p1Ani 3s 1s both $bezier-shape;

  .p2 {
    position: absolute;
    height: 220px;
    width: 0;
    border-left: 300px solid brown;
    border-bottom: 71px solid transparent;
    animation: p2Ani 3s 1s both $bezier-shape;

  .p3 {
    position: absolute;
    height: 191px;
    width: 0;
    border-left: 100px solid brown;
    border-bottom: 24px solid transparent;
    animation: p3Ani 3s 1s both $bezier-shape;

  .p4 {
    position: absolute;
    height: 300px;
    width: 0;
    border-right: 400px solid brown;
    border-top: 95px solid transparent;
    transform: translate3d(0,219px,0);

/* Adjust the transforms and keyframe sets below */
@keyframes p1Ani {
  from { transform: translate(0,0); }
  33% { transform: translate(0,0); }
  66% { transform: translate(0,0); }
  to { transform: translate(0,0); }

@keyframes p2Ani {
  from { transform: translate(100px,0); }
  33% { transform: translate(100px,0); }
  66% { transform: translate(100px,0); }
  to { transform: translate(100px,0); }

@keyframes p3Ani {
  from { transform: translate(0,100px); }
  33% { transform: translate(0,100px); }
  66% { transform: translate(0,100px); }
  to { transform: translate(0,100px); }

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.


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