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

              
                <!--<div class="vert-divider"></div>
<div class="horiz-divider"></div>-->
<div class="container">
  <div class="contrast-toggle">
    <span>contrast</span>
  </div>
  <div class="brightness-toggle">
    <span class="toggle-active">brightness</span>
  </div>

<div class="selector-background">
  
  <div class="brightness-arm">
    <div class="selector-brightness selector-active"></div>
  </div>
  <div class="contrast-arm">
    <div class="selector-contrast"></div>
  </div>
  
  <div class="button-container">
    <div class="button-top">
      <img class="arrow" src="https://i.imgur.com/0tXLwcf.png"/>
    </div>
    <div class="button-bottom">
      <img class="arrow" src="https://i.imgur.com/0tXLwcf.png"/>
    </div>
    <div class="button-value">
      <div class="value">50</div>
    </div>
  </div>
</div>
</div>
              
            
!

CSS

              
                $dial-radius: 400px
$selector-radius: 300px
$button-radius: 230px
$value-radius: 100px
$arrow-width: 36px
$indicator-width: 8px
@import url(https://fonts.googleapis.com/css?family=Poiret+One)

body
  height: 500px
  background: linear-gradient(to bottom, #EDEEEA, #C3CFCE)

span
  font-family: 'Poiret One', cursive
  font-size: 22px
  position: relative
  top: 30px
  transition: all 1s ease
  user-select: none
  
img
  user-select: none

.container
  width: $dial-radius
  height: $dial-radius

.brightness-toggle
  position: absolute
  left: $dial-radius/2
  width: $dial-radius/2
  height: $dial-radius
  cursor: pointer
  span
    left: 80px
  
.contrast-toggle
  position: absolute
  width: $dial-radius/2
  height: $dial-radius
  cursor: pointer
  span
    left: 50px
    
.toggle-active
  text-shadow: 0 0 15px green

.arm
  width: $selector-radius
  height: $indicator-width
  position: absolute
  top: $selector-radius/2 - $indicator-width

.brightness-arm 
  @extend .arm
  transform: rotate(85deg)
  .selector-brightness 
    @extend .selector
    left: $selector-radius - $indicator-width*2
  
.contrast-arm
  @extend .arm
  transform: rotate(-85deg)
  .selector-contrast
    @extend .selector
    left: $indicator-width - 2px
  
.selector 
  position: relative
  height: $indicator-width
  width: $indicator-width
  border-radius: $indicator-width
  border: 1px solid white
  transition: all 0.5s ease
  
.selector-active 
  background: white
  box-shadow: 0px 0px 1px 0px white

.selector-background 
  height: $selector-radius
  width: $selector-radius
  top: $dial-radius/2 - $selector-radius/2
  margin: 0 auto
  background: rgba(0,0,0,0.6)
  border-radius: $selector-radius
  position: relative
  
.button-container
  height: $button-radius
  width: $button-radius
  background: white
  border-radius: $button-radius
  box-shadow: 0px 5px 20px 10px rgba(0,0,0,0.4)
  position: relative
  left: ($selector-radius - $button-radius)/2
  top: ($selector-radius - $button-radius)/2
  overflow: hidden

  .button-top 
    height: $button-radius / 2 
    width: $button-radius
    background: hsla(0,0%,98%,1)
    .arrow 
      position: relative
      width: $arrow-width
      left: $button-radius/2 - $arrow-width/2
      top: $arrow-width/2
      transform: rotate(180deg)

  .button-bottom
    height: $button-radius / 2 
    width: $button-radius
    background: hsla(0,0%,90%,1)
    .arrow 
      position: relative
      width: $arrow-width
      left: $button-radius/2 - $arrow-width/2
      top: $arrow-width*2
  
  .button-value 
    height: $value-radius
    width: $value-radius
    border-radius: $value-radius
    background: hsla(0,0%,100%,1)
    position: absolute
    left: $value-radius / 1.5
    top: $value-radius / 1.5
    .value 
      text-align: center
      font-family: Helvetica, sans-serif
      font-weight: 100
      font-size: 50px
      color: rgba(0,0,0,0.4)
      padding-top: 20px
      transition: all 0.5s ease
      user-select: none

.button-selected
  animation: selected 0.15s ease-in-out
  
@keyframes selected
  0%
    background: rgba(0,0,0,0.2)
    
              
            
!

JS

              
                (function() {
  
  var upButton = $('.button-top'),
      downButton = $('.button-bottom'),
      value = $('.value'),
      brightnessSelector = $('.selector-brightness'),
      contrastSelector = $('.selector-contrast'),
      brightnessArm = $('.brightness-arm'),
      contrastArm = $('.contrast-arm'),
      brightnessToggle = $('.brightness-toggle'),
      contrastToggle = $('.contrast-toggle');
  var brightness = 0,
      contrast = 0;
      
  // Setup 
  var brightnessSelected = true;
  value.textContent = brightness;
  
  // Event Listeners
  upButton.addEventListener('click', function() {
    upButton.classList.remove('button-selected');
    upButton.offsetWidth = upButton.offsetWidth;
    upButton.classList.add('button-selected');
    
    if (brightnessSelected)
      increaseBrightness()
    else
      increaseContrast()
  });
  
  downButton.addEventListener('click', function() {
    downButton.classList.remove('button-selected');
    downButton.offsetWidth = downButton.offsetWidth;
    downButton.classList.add('button-selected');
    if (brightnessSelected)
      decreaseBrightness()
    else
      decreaseContrast()
  });
  
  brightnessToggle.addEventListener('click', function() {
    brightnessSelected = true;
    value.textContent = brightness;
    brightnessSelector.classList.add('selector-active');
    contrastSelector.classList.remove('selector-active');
    $('.brightness-toggle span').classList.add('toggle-active');
    $('.contrast-toggle span').classList.remove('toggle-active');
  });
  
  contrastToggle.addEventListener('click', function() {
    brightnessSelected = false;
    value.textContent = contrast;
    brightnessSelector.classList.remove('selector-active');
    contrastSelector.classList.add('selector-active');
    $('.brightness-toggle span').classList.remove('toggle-active');
    $('.contrast-toggle span').classList.add('toggle-active');
  });
  
  function increaseBrightness() {
    if (brightness >= 100) {return}
    value.textContent = brightness >= 100 ? 100 : ++brightness;
    /*var deg = -1.7 * brightness + 85;*/
    var deg = convertToDeg(brightness);
    brightnessArm.style.webkitTransform = 'rotate('+deg+'deg)'; 
    brightnessArm.style.mozTransform    = 'rotate('+deg+'deg)'; 
    brightnessArm.style.msTransform     = 'rotate('+deg+'deg)'; 
    brightnessArm.style.oTransform      = 'rotate('+deg+'deg)'; 
    brightnessArm.style.transform       = 'rotate('+deg+'deg)';
  }
  
  function decreaseBrightness() {
    if (brightness <= 0) {return}
    value.textContent = brightness <= 0 ? 0 : --brightness;
    var deg = convertToDeg(brightness);
    brightnessArm.style.transform = 'rotate('+deg+'deg)';
  }
  
  function increaseContrast() {
    if (contrast >= 100) {return}
    value.textContent = contrast >= 100 ? 100 : ++contrast;
    var deg = convertToDeg(contrast);
    contrastArm.style.transform = 'rotate(-'+deg+'deg)';
  }
  
  function decreaseContrast() {
    if (contrast <= 0) {return}
    value.textContent = contrast <= 0 ? 0 : --contrast;
    var deg = convertToDeg(contrast);
    contrastArm.style.transform = 'rotate(-'+deg+'deg)';
  }
  
  function convertToDeg(value) {
    return -1.7 * value + 85;
  }
  
  function $(selector) {
    return document.querySelector(selector);
  }
}());


              
            
!
999px

Console