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="stage example example4">
  <div class="scaler">
    <div class="triangle one">
      <figure class="front"> </figure>
      <figure class="back"> </figure>
      <figure class="side1"> </figure>
      <figure class="side2"> </figure>
      <figure class="side3"> </figure>
    </div>
    <div class="triangle two">
      <figure class="front"> </figure>
      <figure class="back"> </figure>
      <figure class="side1"> </figure>
      <figure class="side2"> </figure>
      <figure class="side3"> </figure>
    </div>
    <div class="triangle three">
      <figure class="front"> </figure>
      <figure class="back"> </figure>
      <figure class="side1"> </figure>
      <figure class="side2"> </figure>
      <figure class="side3"> </figure>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import compass

=animation($values...)
  -webkit-animation: $values
  -moz-animation: $values
  -o-animation: $values
  -ms-animation: $values
  animation: $values

//============================================================
//
// arrow
//
// @param width           :  px, em
// @param height          :  px, em
// @param direction       :  up, down, left, right
// @param color           :  hex, rgb
//
//============================================================

=arrow($width: 20px, $height: 20px, $direction: up, $color: red)
  
  width: 0 
  height: 0
  
  // Right
  @if $direction == right
    border-top: $height/2 solid transparent
    border-bottom: $height/2 solid transparent
    border-left: $width solid $color

  // Left
  @if $direction == left
    border-top: $height/2 solid transparent
    border-bottom: $height/2 solid transparent
    border-right: $width solid $color

  // Up
  @if $direction == up
    border-left: $width/2 solid transparent
    border-right: $width/2 solid transparent
    border-bottom: $height solid $color

  // Down
  @if $direction == down
    border-left: $width/2 solid transparent
    border-right: $width/2 solid transparent
    border-top: $height solid $color


$animationDuration: 5s
$triangleColour: #ffd200
$triangleLightColour: #ffe403
$triangleDarkColour: #ffd200

body
  background-color: #666

.stage
  position: relative
  width: 300px
  height: 200px
  @include border-radius(5px)
  @include perspective(800px)
  @include perspective-origin(120% -200px) 

  .triangle
    position: absolute
    top: 0
    left: 75px
    width: 150px
    height: 150px
    @include transform-style(preserve-3d)
    @include transform-origin(125px)

    figure
      display: block
      position: absolute
      @include backface-visibility(hidden)

  &.example4

    .triangle
      top: 20px
      @include animation(rotate 5s linear infinite)

    figure
      &.front
        +arrow(150px, 150px, up, $triangleLightColour)
        @include transform(translateZ(20px))

      &.back
        +arrow(150px, 150px, up, $triangleLightColour)
        @include transform(translateZ(-20px) rotateY(180deg))

      &.side1
        content: " "
        display: block
        position: absolute
        height: 168px
        width: 40px
        background-color: $triangleDarkColour
        @include transform(translateY(-9px) translateX(18px) rotateY(-90deg) rotateX(26.5deg))

      &.side2
        content: " "
        display: block
        position: absolute
        height: 168px
        width: 40px
        background-color: $triangleDarkColour
        @include transform(translateY(-9px) translateX(92px) rotateY(90deg) rotateX(26.5deg))

      &.side3
        content: " "
        background-color: $triangleDarkColour
        width: 150px
        height: 40px
        @include transform(translateY(130px) rotateX(-90deg))

  &.example4
    @include perspective-origin(120% -200px)

    .scaler
      @include transform(scale(0.8))
      position: absolute
      top: -20px
      left: 40px
    .triangle
      top: 0
      @include animation(rotate $animationDuration infinite linear)

      &.two
        top: 150px
        left: 0

      &.three
        top: 150px
        left: 150px
        
=keyframes($name)
  @-webkit-keyframes #{$name}
    @content
  @-moz-keyframes #{$name}
    @content
  @-ms-keyframes #{$name}
    @content
  @keyframes #{$name}
    @content
  
@include keyframes(rotate)
  0%
    @include transform(rotateY(0))
  100%
    @include transform(rotateY(360deg)) 
              
            
!

JS

              
                
              
            
!
999px

Console