cssAudio - ActiveCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="panel">
  <div id="panel-inner">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Harum molestiae necessitatibus dignissimos, fuga quod eveniet adipisci sed quam asperiores corrupti suscipit, vero nostrum et inventore nulla iusto voluptate accusamus iure modi eius ab? Hic illo rem tenetur dolore corporis a architecto dolorem reprehenderit ipsum harum quaerat, alias ex officia beatae maxime accusantium eius.
    <a class="panel-close"><svg class="icon-line_x"><use xlink:href="#icon-line_x"></use></svg></a>
    <footer>
      <button class="border-radius-left">Button 1</button>
      <button class="border-radius-right">Button 2</button>
    </footer>
  </div>
</div>

<svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-line_x" viewBox="0 0 1024 1024">
	<title>line_x</title>
	<path class="path1" d="M265.376 758.624c6.256 6.256 14.432 9.376 22.624 9.376s16.368-3.12 22.624-9.376l201.376-201.376 201.376 201.376c6.256 6.256 14.432 9.376 22.624 9.376s16.368-3.12 22.624-9.376c12.496-12.496 12.496-32.752 0-45.248l-201.376-201.376 201.376-201.376c12.496-12.496 12.496-32.752 0-45.248s-32.752-12.496-45.248 0l-201.376 201.376-201.376-201.376c-12.496-12.496-32.752-12.496-45.248 0s-12.496 32.752 0 45.248l201.376 201.376-201.376 201.376c-12.496 12.496-12.496 32.752 0 45.248z"></path>
</symbol>
</defs>
</svg>
            
          
!
            
              @import compass

body
  margin: 4em
  background: #f7f7f7
  font-family: Lato
  font-weight: 300
  line-height: 1.4em
  
a, button
  transition: all .2s ease-out
  cursor: pointer

[class^="icon-"], [class*=" icon-"]
  display: inline-block
  width: 1em
  height: 1em
  fill: currentColor
  
#panel
  position: absolute
  width: 500px
  height: auto
  top: 50%
  left: 50%
  perspective: 1000px
  
  @include transition( all .15s ease-out )
  @include transform( translate(-50%, -50%) rotateY(0deg) rotateX(0deg) rotateZ(0deg) )
    
  #panel-inner
    background: #fff
    box-shadow: 0 20px 100px rgba(0,0,0,.2)
    padding: 3em
    border-radius: 16px
    
    .panel-close
      display: block
      position: absolute
      top: 0
      right: 0
      width: 3em
      line-height: 3em
      text-align: center
      border-radius: 0 16px 0 16px
      color: #aaa
      
      svg
        pointer-events: none
      
      &:hover
        background: #f7f7f7
        
  footer
    margin: 2.5em -3em -3em -3em
    overflow: hidden
    
    button
      display: block
      width: 50%
      padding: 1.5em 1em
      float: left
      background: #fff
      border: none
      border-top: 1px solid #eee
      color: #888
      outline: none
      
      &.border-radius-left
        border-radius: 0 0 0 16px
        
      &.border-radius-right
        border-radius: 0 0 16px 0
      
      &:hover
        background: #eee
            
          
!
            
              var $panel = $('#panel-inner');
var maxY = 20,
    maxX = 20,
    maxZ = 2;

$panel.mousemove( function(e){
  var $this = $(this);
  e.stopImmediatePropagation();
  var offsetY = (e.target!=e.deletageTarget)? e.offsetY+e.target.offsetTop:e.offsetY;
  var offsetX = (e.target!=e.deletageTarget)? e.offsetX+e.target.offsetLeft:e.offsetX;
  var w = $panel.outerWidth(), h = $panel.outerHeight();
  var transform = { y: 1-offsetX/w*2, x: 0-(1-offsetY/h*2) };
  transform.z = 0-(transform.x * transform.y);
  
  var transformCSS = { 
    x: calculateValue(maxX, transform.x),
    y: calculateValue(maxY, transform.y), 
    z: calculateValue(maxZ, transform.z) };
  
  $this.css({
    transform:
    'rotateY('+transformCSS.y+'deg) rotateX('+transformCSS.x+'deg) rotateZ('+transformCSS.z+'deg)'
  });
});

$panel.mouseleave(function(){
  var $this = $(this);
  $this.css({
    transform:
    'rotateY(0deg) rotateX(0deg) rotateZ(0deg)',
    transition: 'all .15s ease-out'
  });
});

function calculateValue( max, value ){
  return max*value;
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console