Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <!-- 
Based on the work of Jardson Almeida
https://dribbble.com/shots/2578447-Page-Control-Indicator-Animation-Collection

Follow me on twitter: @giuband
-->
<div class="container">
<div class="page page-1">
  <ol>
    <li class="circle circle-indicator-one">
    </li>
    <li class="circle circle-mid-opacity"></li>
    <li class="circle circle-mid-opacity"></li>
    <li class="circle circle-mid-opacity"></li>
  </ol>
</div>
  <div class="page page-2">
    <ol>
    <li class="circle circle-bordered circle-bordered-one">
    </li>
    <li class="circle circle-bordered circle-bordered-two"></li>
    <li class="circle circle-bordered circle-bordered-three"></li>
    </ol>
</div>
  <div class="page page-3">
    <ol>
      <li class="rect rect-indicator"></li>
      <li class="rect"></li>
      <li class="rect"></li>
      <li class="rect"></li>
    </ol>
</div>
  <div class="page page-4">
    <span class="border-indicator">
    </span>
    <ol class="ol-4">
      <li class="circle circle-mid-opacity circle-pg-4-one"></li>
    <li class="circle circle-mid-opacity circle-pg-4-two"></li>
    <li class="circle circle-mid-opacity circle-pg-4-three"></li>
    </ol>
</div>
</div>
              
            
!

CSS

              
                $container-width: 800px;
$container-height: 600px;
$circle-width: 20px;
$one-width-multiplier: 1.8;
$animation-length: 2s;
$rect-width: 40px;
$rect-height: 4px;
$mid-opacity-color: rgba(255, 255, 255, 0.5);
$border-indicator-width: $circle-width * 1.6;

.container {
  width: $container-width;
  height: $container-height;
  margin: 50px auto;
  box-shadow: 0 2px 10px rgba(10, 4, 8, 0.7);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

.page {
  flex-basis: $container-width/2;
  position: relative;
  height: $container-height/2;
  display: flex;
  ol:not(.ol-4) {
    list-style: none;
    padding: 0;
    margin: auto;
    position: relative;
  }
}

.circle {
  display: inline-block;
  width: $circle-width;
  height: $circle-width;
  border-radius: $circle-width / 2;
  margin: $circle-width/2 - 2px;
  float: left;
}

.circle-bordered {
  box-shadow: 0 0 0 1px white;
  width: $circle-width;
  height: $circle-width;
  position: relative;
  &:after {
    content: '';
    left: $circle-width/2;
    top: $circle-width/2;
    border-radius: 50%;
    position: absolute;
  }
}

.circle-mid-opacity {
  background-color: $mid-opacity-color;
}

.circle-indicator {
  background-color: white;
  position: absolute;
}

.circle-indicator-one {
  @extend .circle-indicator;
  animation: one $animation-length infinite alternate linear;
}

@keyframes one {
  from {
    left: 0
  }
  20% {
    left: 0;
    width: $circle-width;
  }
  30% {
    width: $circle-width * $one-width-multiplier;
    left: $circle-width - 2px;
  }
  40% {
    width: $circle-width;
    left: $circle-width * 2 - 5px;
  }
  60% {
    width: $circle-width;
    left: $circle-width * 2 - 5px;
  }
  70% {
    width: $circle-width * $one-width-multiplier;
    left: $circle-width * 3 - 7px;
  }
  80% {
    width: $circle-width;
    left: $circle-width * 4 - 10px;
  }
  to {
    width: $circle-width;
    left: $circle-width * 4 - 10px;
  }
}

.circle-bordered-one {
  &:after {
    animation: two $animation-length infinite alternate ease-in-out;
  }
}

.circle-bordered-two {
  &:after {
    animation: two-two $animation-length infinite alternate ease-in-out;
  }
}

.circle-bordered-three {
  &:after {
    animation: two-three $animation-length infinite alternate ease-in-out;
  }
}

@mixin fill {
  width: 2px;
  height: 2px;
  box-shadow: 0 0 0 $circle-width/2 white;
  background-color: rgba(255,255,255,1);
  margin-left: -1px;
  margin-top: -1px;
}

@mixin no-fill {
  width: $circle-width;
  height: $circle-width;
  box-shadow: 0 0 0 0 white;
  margin-left: -$circle-width/2;
  margin-top: -$circle-width/2;
}

@mixin fill-fix {
  background-color: rgba(255,255,255,0);
}

@keyframes two {
  from {
    @include fill;
  }
  20% {
    @include fill;
  }
  20.1% {
    @include fill-fix;
  }
  40% {
    @include no-fill;
  }
  to {
    @include no-fill;
  }
}

@keyframes two-two {
  from {
    @include no-fill;
  }
  20% {
    @include no-fill;
  }
  39.9% {
    @include fill-fix;
  }
  40% {
    @include fill;
  }
  60% {
    @include fill;
  }
  60.1% {
    @include fill-fix;
  }
  80% {
    @include no-fill;
  }
  to {
    @include no-fill;
  }
}

@keyframes two-three {
  from {
    @include no-fill;
  }
  60% {
    @include no-fill;
  }
  79.9% {
    @include fill-fix;
  }
  80% {
    @include fill;
  }
  to {
    @include fill;
  }
}

.rect {
  display: inline-block;
  background-color: $mid-opacity-color;
  width: $rect-width;
  height: $rect-height;
  margin: $rect-width/5;
  border-radius: $rect-height;
}

.rect-indicator {
  position: absolute;
  background-color: white;
  animation: three $animation-length infinite alternate ease-in-out;
}

@mixin move-rect($step) {
  left: $rect-width * 2 * $step - 2.5 * $step * $rect-width/5;
}

@keyframes three {
  from {
    @include move-rect(0);
  }
  20% {
    @include move-rect(0);
  }
  40% {
    @include move-rect(1);
  }
  60% {
    @include move-rect(1);
  }
  80% {
    @include move-rect(2);
  }
  to {
    @include move-rect(2);
  }
}

.border-indicator {
  position: absolute;
  width: $border-indicator-width;
  height: $border-indicator-width;
  border-radius: 50%;
  border: 1px solid white;
  top: 50%;
  left: 50%;
  margin-top: -$border-indicator-width/2;
  margin-left: -$border-indicator-width/2;
}

ol.ol-4 {
  list-style: none;
  padding: 0;
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 117px;
  overflow-x: hidden;
  margin-left: -$border-indicator-width/2 - 1px;
  margin-top: -$border-indicator-width/2 - 1px;
  animation: ol4shift $animation-length infinite alternate ease-in-out;
}

@mixin move-circles-4 ($step) {
  margin-left: -$border-indicator-width/2 - 1px - ($step * 1.8 * $circle-width);
}

.circle-pg-4-one {
  animation: pg-4-one $animation-length infinite alternate ease-in-out;
}

.circle-pg-4-two {
  animation: pg-4-two $animation-length infinite alternate ease-in-out;
}

.circle-pg-4-three {
  animation: pg-4-three $animation-length infinite alternate ease-in-out;
}

@keyframes ol4shift {
  from {
    @include move-circles-4(0);
  }
  20% {
    @include move-circles-4(0);
  }
  40% {
    @include move-circles-4(1);
  }
  60% {
    @include move-circles-4(1);
  }
  80% {
    @include move-circles-4(2);
  }
  to {
    @include move-circles-4(2);
  }
}

@keyframes pg-4-one {
  from {
    background-color: white;
  }
  20% {
    background-color: white;
  }
  40% {
    background-color: $mid-opacity-color;
  }
  to {
    background-color: $mid-opacity-color;
  }
}

@keyframes pg-4-two {
  from {
    background-color: $mid-opacity-color;
  }
  20% {
    background-color: $mid-opacity-color;
  }
  40% {
    background-color: white;
  }
  60% {
    background-color: white;
  }
  80% {
    background-color: $mid-opacity-color;
  }
  to {
    background-color: $mid-opacity-color;
  }
}

@keyframes pg-4-three {
  from {
    background-color: $mid-opacity-color;
  }
  60% {
    background-color: $mid-opacity-color;
  }
  80% {
    background-color: white;
  }
  to {
    background-color: white;
  }
}

.page-1 {
  background-image: linear-gradient(135deg, #ffc46e, #f043bf 100%);
}

.page-2 {
  background-image: linear-gradient(-135deg, #9cece3, #4b3cf2);
}

.page-3 {
  background-image: linear-gradient(45deg, #8ecbe6, #e743c3);
}

.page-4 {
  background-image: linear-gradient(-45deg, #fbdee1, #4b3cf2);
}
              
            
!

JS

              
                
              
            
!
999px

Console