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

              
                - const IMAGES = ['https://images.unsplash.com/photo-1544568100-847a948585b9?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1517423440428-a5a00ad493e8?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1510771463146-e89e6e86560e?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1507146426996-ef05306b995a?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1530281700549-e82e7bf110d6?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1548199973-03cce0bbc87b?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1552053831-71594a27632d?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1518717758536-85ae29035b6d?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1535930891776-0c2dfb7fda1a?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ', 'https://images.unsplash.com/photo-1504595403659-9088ce801e29?ixlib=rb-1.2.1&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=400&fit=max&ixid=eyJhcHBfaWQiOjE0NTg5fQ']
- const SIDE_LENGTH = 300
- const RADIUS = SIDE_LENGTH / 10 * Math.sqrt(25 + 10 * Math.sqrt(5))
- const ANGLE = Math.asin(RADIUS / SIDE_LENGTH) * (180 / Math.PI)
.gallery(style=`--side: ${SIDE_LENGTH}; --radius: ${RADIUS}; --angle: ${ANGLE}`)
  for image, index in IMAGES
    input(type="radio", name="gallery" checked=image===IMAGES[0], id=index)
  .gallery__images
    for image in IMAGES
      img(src=image, alt="")
  .gallery__controls
    for image, index in IMAGES
      .gallery__control-set
        label.gallery__control.gallery__control--left(for=`${index === 0 ? IMAGES.length - 1 : index - 1}`)
          span(title="Show previous doggo")
            svg(viewbox='0 0 24 24')
              path(d='M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z')
        label.gallery__control.gallery__control--right(for=`${index === IMAGES.length - 1 ? 0 : index + 1}`)
          span(title="Show next doggo")
            svg(viewbox='0 0 24 24', title="Show next doggo")
              path(d='M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z')

  .gallery__indicators
    for image, index in IMAGES
      label.gallery__indicator(for=index)
              
            
!

CSS

              
                *
  box-sizing border-box

:root
  --inactive-opacity 0.35
  --inactive-scale 0.25
  --indicator-size 20
  --control-size 24
  --indicator-color hsl(0, 0%, 100%)
  --transition 0.25
  --bg #222

body
  min-height 100vh
  background var(--bg)
  overflow hidden
  margin 0

.gallery
  height calc(var(--side) * 2px)
  left 50%
  overflow hidden
  position absolute
  top 50%
  transform translate(-50%, -50%) scale(var(--gallery-scale, var(--inactive-scale)))
  width calc(var(--side) * 2px)

  &:hover
    --gallery-scale 1
    --controls-opacity 1
    --indicators-opacity 1

    @media(max-width 768px)
      --gallery-scale 0.55
    
    .gallery__images
      animation entrance calc(var(--transition) * 1s) ease

    [name="gallery"]
      for $num in (1..10)
        &:nth-of-type({$num}):checked ~ .gallery__images img:nth-of-type({$num})
          --opacity 1
          --z 1
          --grayscale 0

  // Hide all the radio buttons
  [name="gallery"]
    opacity 0
    position absolute
    right 100%

    for $num in (1..10)
      &:nth-of-type({$num}):checked
        ~ .gallery__images
          $multiplier = 1
          if $num % 2 > 0
            $multiplier = -1
          --active-x 'calc(var(--angle) * %s)' % $multiplier 
        ~ .gallery__controls .gallery__control-set:nth-of-type({$num})
          display block
        ~ .gallery__indicators .gallery__indicator:nth-of-type({$num})
          --opacity 1
    
    for $num in (0..4)
      &:nth-of-type({$num * 2 + 1}):checked
      &:nth-of-type({$num * 2 + 2}):checked
        ~ .gallery__images
          --active-y $num * (360 / -5)
  
  // Indicators at bottom of control. Only show on hover
  &__indicators
    bottom calc(var(--control-size) * 1px)
    display grid
    grid-gap calc(var(--control-size) * 0.5px)
    grid-template-columns repeat(10, 1fr)
    left 50%
    opacity var(--indicators-opacity, 0)
    position absolute
    transform translate(-50%, 0)

  &__indicator
    background var(--indicator-color)
    border-radius 50%
    cursor pointer
    display block
    height calc(var(--control-size) * 0.5px)
    opacity var(--opacity, 0.25)
    transition all calc(var(--transition) * 1s) ease
    width calc(var(--control-size) * 0.5px)

  &__controls
    opacity var(--controls-opacity, 0)

  &__control-set
    display none

  &__control
    background transparent
    height 100%
    position absolute
    width 20%
    top 0

    svg
      background var(--indicator-color)
      border-radius 50%
      cursor pointer
      height calc(var(--control-size) * 1px)
      opacity var(--opacity, var(--inactive-opacity))
      position absolute
      top 50%
      transition all calc(var(--transition) * 1s)
      width calc(var(--control-size) * 1px)
      
      &:hover
        --opacity 1

      path
        fill var(--bg)
    
    &--left
      left calc(var(--control-size) * 1px)

      svg
        left 0
        transform translate(0, -50%) rotate(180deg)
        
    &--right
      right calc(var(--control-size) * 1px)

      svg
        right 0
        transform translate(0, -50%)

  &__images
    animation rotate 10s infinite linear
    height calc(var(--side) * 2px)
    left 0
    position absolute
    top 0
    transition all .25s ease 0s
    transform rotateX(calc(var(--active-x) * 1deg)) rotateY(calc(var(--active-y) * 1deg))
    transform-style preserve-3d
    width calc(var(--side) * 2px)

  img
    -webkit-clip-path var(--clip)
    clip-path var(--clip)
    height calc(var(--side) * 1px)
    filter grayscale(var(--grayscale, 1))
    left 50%
    object-fit cover
    opacity var(--opacity, var(--inactive-opacity))
    position absolute
    top 50%
    transform translate(-50%, -50%) rotateY(calc(var(--index) * 72deg)) translateY(calc(var(--translate) * 50%)) translateZ(calc(var(--radius) * 1px)) rotateX(calc((var(--angle) * var(--tilt)) * 1deg)) translate3d(0, 0, calc(var(--z, 0) * 1px))
    transform-origin var(--origin)
    transition all calc(var(--transition) * 1s) ease
    width calc(var(--side) * 1px)

    for $num in (0..4)
      &:nth-of-type({$num * 2 + 1})
      &:nth-of-type({$num * 2 + 2})
        --index $num

    &:nth-of-type(odd)
      --clip polygon(0 100%, 50% 0, 100% 100%)
      --origin bottom
      --tilt 1
      --translate -1

    &:nth-of-type(even)
      --clip polygon(0 0, 50% 100%, 100% 0)
      --origin top
      --tilt -1
      --translate 1



@keyframes rotate
  from
    transform rotateX(45deg) rotateY(45deg)
  to
    transform rotateX(405deg) rotateY(765deg)

@keyframes entrance
  from
    transform rotateX(45deg) rotateY(45deg)
              
            
!

JS

              
                // 404
              
            
!
999px

Console