Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                label for="animation-picker" Select animation:
select id="animation-picker"
  optgroup label='Wave'
    option value='wave' selected='' Wave
    option value='reversewave' Reverse Wave
  optgroup label='Pulse'
    option value='pulse' Pulse
    option value='boxpulse' Boxpulse
    option value='dotpulse' Dotpulse
  optgroup label='Line'
    option value='vline' Vertical Line
    option value='hline' Horizontal Line
    option value='neline' Diagonal Line
  optgroup label='Fade'
    option value='vfade' Vertical Fade
    option value='hfade' Horizontal Fade
    option value='nefade' Diagonal Fade
    option value='rfade' Ripple Fade
  optgroup label='Ripple'
    option value='rippleout' Ripple Out
    option value='ripplein' Ripple In

.grid.wave
  - for i in 1..121
    div
              
            
!

CSS

              
                @import compass
@import "compass/layout"

$divs: 121
$side: 24px
$gutter: 6px
$columns: 11
$rows: $divs / $columns
$gridwidth: $columns * ($side + $gutter)
$fade: 4s

$default: #181818
$accent: #2ecc71

=animate($animation, $duration, $delay: 0s)
  animation: $animation $duration ease-in-out $delay infinite
  -webkit-animation: $animation $duration ease-in-out $delay infinite
    
@keyframes pulse
  50%
    background: $accent
@-webkit-keyframes pulse
  50%
    background: $accent
  
@keyframes flash
  20%
    background: $accent
  40%
    background: $default
@-webkit-keyframes flash
  20%
    background: $accent
  40%
    background: $default
  
html
  background: #111
  
label, #animation-picker
  display: block
  margin: 24px
  font: bold 12px sans-serif
  color: #bbb
  
  
#animation-picker
  height: 36px
  width: $gridwidth / 2
  margin-top: -22px
  border: none
  outline: none
  font-weight: normal
  background: #282828

.grid
  +stretch(0)
  height: $rows * ($side + $gutter)
  width: $gridwidth
  margin: auto
  font-size: 0
  
  div
    display: inline-block
    height: $side
    width: $side
    margin: $gutter / 2
    background: $default
      
// WAVE
    
.wave div
  @for $i from 1 through $divs
    &:nth-child(#{$i})
      +animate(pulse, 3s, 3s*($i / $divs))
              
.reversewave div
  @for $i from 1 through $divs
    &:nth-child(#{$i})
      +animate( pulse, 3s, 3s*(-$i / $divs))
        
// FLASH
    
.pulse div  
  +animate(pulse, 2s)
    
.boxpulse div
  &:nth-child(-n + #{$columns}),
  &:nth-child(n + #{$divs + 1 - $columns}),
  &:nth-child(#{$columns}n),
  &:nth-child(#{$columns}n + 1)
    +animate(pulse, 2s)
      
.dotpulse div
  &:nth-child(#{ceil($divs / 2)})
    +animate(pulse, 2s)

// LINES

.hline div
  @for $i from 0 through $rows
    $start: $i * $rows + 1
    &:nth-child(n + #{$start}):nth-child(-n + #{$start + $rows})
      +animate(flash, 1s, 1s*($i / $rows))
        
.vline div
  @for $i from 0 through $columns
    &:nth-child(#{$columns}n + #{$i})
      +animate(flash, 1s, 1s*($i / $rows))
        
.neline div
  @for $m from 0 to $rows
    @for $n from 1 through $columns
      &:nth-child(#{$n + $m * $columns})
        +animate(flash, 1s, 1s*(($m + $n) / $rows))
          
// FADE

.vfade div
  @for $i from 0 through $rows
    $start: $i * $rows + 1
    &:nth-child(n + #{$start}):nth-child(-n + #{$start + $rows})
      +animate(pulse, .5s * $rows, 1s*($i / $rows))
        
.hfade div
  @for $i from 0 through $columns
    &:nth-child(#{$columns}n + #{$i})
      +animate(pulse, .5s * $rows, 1s*($i / $rows))
        
.nefade div
  @for $m from 0 to $rows
    @for $n from 1 through $columns
      &:nth-child(#{$n + $m * $columns})
        +animate(pulse, .5s * $rows, 1s*(($m + $n) / $rows))
          
.rfade div
  +animate(pulse, .5s * $rows)
  $levels: floor($rows / 2)
  @for $m from 1 through $levels
    $reach: ($levels - $m) * 2
    @for $n from 0 through $reach
      $start: $m * $columns + 1 + $m + $n * $columns
      &:nth-child(n + #{$start}):nth-child(-n + #{$start + $reach})
        +animate(pulse, .5s * $rows, #{- 2s * $m / ($levels + 1)})
        
// RIPPLE

.rippleout div
  +animate(flash, 2s)
  $levels: floor($rows / 2)
  @for $m from 1 through $levels
    $reach: ($levels - $m) * 2
    @for $n from 0 through $reach
      $start: $m * $columns + 1 + $m + $n * $columns
      &:nth-child(n + #{$start}):nth-child(-n + #{$start + $reach})
        +animate(flash, 2s, #{- 2s * $m / ($levels + 1)})
          
.ripplein div
  +animate(flash, 2s)
  $levels: floor($rows / 2)
  @for $m from 1 through $levels
    $reach: ($levels - $m) * 2
    @for $n from 0 through $reach
      $start: $m * $columns + 1 + $m + $n * $columns
      &:nth-child(n + #{$start}):nth-child(-n + #{$start + $reach})
        +animate(flash, 2s, #{2s * $m / ($levels + 1)})
              
            
!

JS

              
                gridWidth = $('.grid').width()

$('select').change () ->
  $grid = $('.grid')
  $grid.removeClass().width(gridWidth).addClass "grid #{$(this).val()}"
  
# width is changed to trigger a document reflow, thereby resetting all animations
              
            
!
999px

Console