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

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

              
                <div id='viewer_box'>
  <div id='images_ring'>
    <svg xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 600 600">
      <path class="cls-1" d="M300,0C134.31,0,0,134.31,0,300S134.31,600,300,600,600,465.69,600,300,465.69,0,300,0ZM25,353.42V246.58A6.59,6.59,0,0,1,31.58,240H138.42a6.59,6.59,0,0,1,6.58,6.58V353.42a6.59,6.59,0,0,1-6.58,6.58H31.58A6.59,6.59,0,0,1,25,353.42ZM227.09,455.6l-75.55,75.55a6.57,6.57,0,0,1-9.3,0L66.69,455.6a6.58,6.58,0,0,1,0-9.31l75.55-75.54a6.57,6.57,0,0,1,9.3,0l75.55,75.54A6.58,6.58,0,0,1,227.09,455.6Zm2.16-301.89-75.54,75.54a6.58,6.58,0,0,1-9.31,0L68.85,153.71a6.58,6.58,0,0,1,0-9.31L144.4,68.85a6.58,6.58,0,0,1,9.31,0l75.54,75.55A6.58,6.58,0,0,1,229.25,153.71ZM356.94,568.42a6.59,6.59,0,0,1-6.58,6.58H243.52a6.58,6.58,0,0,1-6.58-6.58V461.58a6.58,6.58,0,0,1,6.58-6.58H350.36a6.59,6.59,0,0,1,6.58,6.58Zm0-430a6.59,6.59,0,0,1-6.58,6.58H243.52a6.58,6.58,0,0,1-6.58-6.58V31.58A6.58,6.58,0,0,1,243.52,25H350.36a6.59,6.59,0,0,1,6.58,6.58Zm13.81,3.82,75.54-75.55a6.58,6.58,0,0,1,9.31,0l75.55,75.55a6.57,6.57,0,0,1,0,9.3L455.6,227.09a6.58,6.58,0,0,1-9.31,0l-75.54-75.55A6.57,6.57,0,0,1,370.75,142.24ZM533.31,457.76l-75.55,75.55a6.57,6.57,0,0,1-9.3,0l-75.55-75.55a6.57,6.57,0,0,1,0-9.3l75.55-75.55a6.57,6.57,0,0,1,9.3,0l75.55,75.55A6.57,6.57,0,0,1,533.31,457.76ZM568.42,360H461.58a6.59,6.59,0,0,1-6.58-6.58V246.58a6.59,6.59,0,0,1,6.58-6.58H568.42a6.59,6.59,0,0,1,6.58,6.58V353.42A6.59,6.59,0,0,1,568.42,360Z"/>
    </svg>
  </div>
  <div id='viewer_back'></div>
  <div id='viewer_lever'></div>  
  <div id='viewer'></div>
  <div id='nose'></div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css2?family=Pacifico&display=swap');

:root {
  --clr-lever:#d00;  
  --color-bg:Indigo;
  --color-circle:#efefef;
}
html {
  display:grid;
  place-items:center;
  min-height:100vh;
  background-color:var(--color-bg);
  background-image: url("https://www.transparenttextures.com/patterns/inspiration-geometry.png");
}
#viewer_box {
  position:relative;
}
#viewer_box * {
  box-sizing:border-box'
}

#images_ring {  
  width:52.5vmin;
  height:52.5vmin;
  position:absolute;
  left:50%;
  top:-50%;  
  z-index:-1;
  transform-origin:center center;
  transition:1s;
  transform:translate(-50%,0);
}
.cls-1 {
  fill:var(--color-circle);
  filter:drop-shadow(0 0 .5vmin rgba(0,0,0,.5));
}

#viewer_lever {
  width:25vmin;
  height:5vmin;
  background:var(--clr-lever);
  position:absolute;
  top:15vmin;
  right:-7vmin;
  transform-origin:left center;
  transform:rotate(-45deg); 
  cursor:pointer;
  filter:drop-shadow(0 0 15px rgba(0,0,0,.5));
}
#viewer_lever:before {
  content:'\00261F';
  width:10vmin;
  height:10vmin;
  background:inherit;
  border-radius:50%;
  position:absolute;
  right:-5vmin;
  top:-2.5vmin;
  color:darkred;
  font-size:10vmin;
  text-align:center;
  line-height:10vmin;
}
.pull_down #viewer_lever{
  animation:pull_down 2s linear forwards;
}
@keyframes pull_down {
  50% { transform:rotate(45deg); }
}

#viewer {
  width:75vmin;
  height:35vmin;
  background-color:#333;
  background-image:var(--bg-image);
  background-size:cover;
  background-position:50% 100%;
  border:1vmin solid red;
  border-radius:50% / 25%;  
  position:relative;
  box-shadow:    
    0 .25vmin 1vmin rgba(0,0,0,.5);
  /*   opacity:.25; */
  overflow:hidden;
}
#viewer:after {
  content:'';
  width:100%;
  height:100%;
  border:inherit;
  border-radius:inherit;
  position:absolute;
  left:-1vmin;
  top:-1vmin;
  box-shadow:
    inset 0 0 0 .5vmin black,
    inset 0 0 3vmin 4vmin rgba(0,0,0,.5);
  background:
    linear-gradient(225deg, #222 50%, transparent 50%),
    linear-gradient(45deg, #222 50%, transparent 50%),
    linear-gradient(-225deg, #000 50%, transparent 50%),
    linear-gradient(-45deg, #000 50%, transparent 50%);
  background-size:200% 100%;
  background-repeat:no-repeat;
  background-position:
    -50% 0, 
    150% 0, 
    150% 0, 
    -50% 0;
}

#viewer_back:before {
  content:'Visualizer 3000';
  width:80%;
  height:165%;
  background:
    radial-gradient(circle at center -35%, transparent 30%, red 30.25%);
  border-radius:15% 15% 15% 15%/ 25% 25% 50% 50%;
  position:absolute;
  left:10%;
  top:-25%;
  z-index:-1;
  filter:drop-shadow(0 0 1vmin rgba(0,0,0,.75));
  display:grid;
  place-items:end center;
  font-size:5vmin;
  line-height:10vmin;
  font-family:'Pacifico',cursive;
  color:darkred;
}

#viewer img {
  width:100%;
  position:absolute;
  left:0;
  top:0;
  transform:translateY(-5%);
}

.pull_down #viewer:after {
  animation:v_pull 1.5s linear forwards;
}
@keyframes v_pull {
  50% { background-position:50% 0; }
  60% { background-position:50% 0; }
}

.pull_down #viewer_lever{
  animation:pull_down 1.5s linear forwards;
}
@keyframes pull_down {
  50% { transform:rotate(45deg); }
}

#nose {
  width:20%;
  height:20%;
  background:linear-gradient(to bottom, red 75%, transparent);
  position:absolute;
  left:40%;
  transform:translateY(-60%);
  border-radius:100% 100% 1% 1%;
  border-top:.5vmin solid black;
  box-shadow:inset 0 2vmin 1vmin -1vmin rgba(0,0,0,.5);
}
              
            
!

JS

              
                const viewer_box = document.querySelector('#viewer_box')
const viewer = document.querySelector('#viewer')
const lever = document.querySelector('#viewer_lever')
const ring = document.querySelector('#images_ring')
var search_terms = ['nature','water','landscape','overhead','birds','fish','mountains','bears','trees','ocean']
var rot_num = 0

function addImage(){
    var img = document.createElement('img')
    var url = 'https://source.unsplash.com/640x360/?'+search_terms[Math.floor(Math.random()*search_terms.length)]+','+search_terms[Math.floor(Math.random()*search_terms.length)]+''
    img.src = url
    viewer.prepend(img)
}
addImage()
addImage()

function changeImage(){
  var img = document.querySelectorAll('#viewer img')
  img[img.length - 1].remove()
  addImage()
}

lever.addEventListener('click', function(){  
  viewer_box.classList.add('pull_down')
  rot_num++    
  setTimeout(function(){  
    changeImage()
    ring.style.transform = 'translate(-50%,0) rotate('+rot_num*90+'deg)'  
  },750)

  setTimeout(function(){
    viewer_box.classList.remove('pull_down')
  },1500)
})
              
            
!
999px

Console