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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                .sandwitch_container
  .sandwitch
    .left
    .right
    .wall1
    .wall2
    .wall3
      .ham
      .cucumber
.buttons
  %button.x 縦に回転
  %button.y 横に回転
  %button.z 奥に回転
              
            
!

CSS

              
                $sw_size: 100px
$sw_thick: 30px
$sw_color: AntiqueWhite 
$left_color: $sw_color
$right_color: $sw_color
$wall1_color: $sw_color
$wall2_color: $sw_color
$wall3_color: $sw_color

*
  box-sizing: border-box
html, body
  overflow: hidden
  height: 100%
  width: 100%
  background: black
  perspective: 2000px
  transform-origin: 50% 50%
  .sandwitch_container
    width: $sw_size * 2
    height: $sw_size * 3
    transform-style: preserve-3d
    transform-origin: 50% 50% #{$sw_size / 2}
    transition: transform 1s
    background: transparent
  .sandwitch
    position: absolute
    top: calc(50% - #{$sw_size / 2})
    left: calc(50%)
    height: $sw_size
    display: inline-block
    transform-origin: 50% 50% #{$sw_size / 2}
    transform: rotateX(-35deg) rotateY(-20deg) translate3d(-50%, -50%, #{$sw_size / 2})
    transform-style: preserve-3d
    perspective: 2000px
    > *
      transform-origin: 0
    .left, .right
      position: absolute
      top: 0
      left: 0
      display: inline-block
      border-bottom: $sw_size solid $sw_color
      border-right: $sw_size solid transparent
      color: skyblue
    .left
      border-bottom-color: $left_color
      transform-origin: 0
      transform: translate3d(0,  0px, 0)
    .right
      border-bottom-color: $right_color
      transform: translate3d(0,  0px, -$sw_thick)
    .wall1, .wall2, .wall3
      position: absolute
      top: 0
      left: 0
      width: $sw_thick
      height: $sw_size
      border: 1px  solid sienna
      border-top: none
      border-bottom: none
    .wall1
      background: $wall1_color
      transform: rotate3d(0, 1, 0, 90deg)
      border: 1px 0 1px 0 solid gray
    .wall2
      transform-origin: 0 100%
      background: $wall1_color
      transform: rotateY(90deg) rotateX(-90deg)
    .wall3
      transform-origin: 0 0
      background: $wall1_color
      transform: rotateY(90deg) rotateX(45deg) scale(1, 1.4142)
      .ham
        box-shadow: 0 0 2px 1px hotpink
        background: pink
        height: 80%
        width: 20%
        border-radius: 30%
        position: absolute
        top: 50%
        left: 40%
        transform: translate(-50%, -50%)
      .cucumber
        background-image: linear-gradient(lightgreen, green 30%, green 70%, lightgreen)
        background-size: 20%
        height: 80%
        width: 20%
        border-radius: 20%
        position: absolute
        top: 50%
        left: 60%
        transform: translate(-50%, -50%)

              
            
!

JS

              
                $ ->
  container = $('.sandwitch_container')
  t =
    x: 0
    y: 0
    z: 0
  set_t = ->
    container.css
      transform: ['rotateX(' + t.x + 'deg)', 'rotateY(' + t.y + 'deg)', 'rotateZ(' + t.z + 'deg)'].join(' ')
  $(document).on 'click', '.buttons button',  ->
    t[$(this).attr('class')] += 10
    set_t()
              
            
!
999px

Console