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

              
                .cloud.cloud-1
.cloud.cloud-2
h1 BB-8 animation with CSS

  .bb8

    .bb8-body

      .dot.dot-1
        .line.line-1
        .line.line-2
        .line.line-3
      .dot.dot-2

      .circle.circle-1
      .circle.circle-2
      .circle.circle-3

    .body-shadow-crop  
      .body-shadow

    .bb8-head

      .head-bottom
        .head-trapeze
        .head-bottom-base

      .head-top-crop
        .head-top

      .lens
      .sensor

    .bb8-shadow


.credit.
  Original Illustration  by <a href="https://dribbble.com/shots/2408834-BB-8">Justas Galaburda</a>
.sand

              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Rubik:300')

// Variables

$bg: #CFEDED
$base: #EBF2FA
$head-shadow: #95C0ED
$stroke: #244356
$orange: #E78518

// Styles

*
  box-sizing: border-box

body
  background: $bg
  font-family: 'Rubik', sans-serif
  letter-spacing: 3px
  text-align: center

.credit
  font-size: 11px
  
h1
  font-size: 18px
  
.sand
  background: #B69C77
  height: 200px
  position: absolute
  width: 100%
  z-index: -1
  right: 0
  bottom: 0
  left: 0

$d: 220px //bb8s size

.bb8
  width: $d
  height: $d
  position: absolute
  bottom: 100px
  left: 40%
  animation: hopMove 3s infinite 2s

.bb8-body
  width: $d
  height: $d
  position: absolute
  background: $base
  border-radius: 50%
  border: $d*.03 solid $stroke
  overflow: hidden
  animation: spinMove 1.2s linear infinite
  
.bb8-shadow
  width: $d
  height: 30px
  background: rgba(0,0,0,0.25)
  border-radius: 50%
  top: 90%
  position: relative
  z-index: -1
  
.body-shadow-crop
  width: $d
  height: $d
  position: absolute
  border-radius: 50%
  overflow: hidden
  
.body-shadow
  width: $d
  height: $d
  border-radius: 50%
  position: absolute
  box-shadow: 0px 0px 50px rgba(0,0,0,0.4)
  left: -12%
  top: 5%
  
.circle
  width: $d*.6
  height: $d*.6
  background-color: $orange
  border-radius: 50%
  border: $d*.03 solid $stroke
  position: absolute
  
  &:after
    content: ''
    border: $d*.03 solid $stroke
    display: block
    position: absolute
    background: $base
    width: 35%
    height: 35%
    top: 50%
    left: 50%
    border-radius: 50%
    transform: translate(-50%, -50%) 
    
.circle-1
  top: 4%
  left: -25%
  
.circle-2
  top: 55%
  left: 50%

.circle-3
  width: $d*1.2
  height: $d*1.2
  top: -80%
  left: 55%

.dot
  background: $stroke
  width: $d*.06
  height: $d*.06
  position: absolute
  border-radius: 50%

.dot-1
  top: 36%
  left: 54%
  
.dot-2
  top: 75%
  left: 28%

.line
  position: absolute
  background: $stroke
  width: $d*.015
  height: $d*.6

.line-1
  transform: rotate(125deg)

.line-2
  transform: rotate(75deg)
  bottom: -60%
  
.line-3
  transform: rotate(10deg)
  top: -60%
  left: 360%
  
.bb8-head
  width: $d*.7
  height: $d*.7
  position: absolute
  top: -28%
  left: 0%
  transform: rotate(-25deg)
  
.sensor
  height: $d*.06
  width: $d*.06
  border-radius: 45%
  background: $stroke
  top: 35%
  right: 35%
  position: absolute
  
  
.head-top
  width: $d*.6
  height: $d*.6
  background: $base
  border: $d*.03 solid $stroke
  border-radius: 50%
  box-shadow: -8px 0px 0px 3px rgba(0,0,0,0.2) inset
  
.head-top-crop
  height: 50%
  overflow: hidden
 
.head-trapeze
  border-top: $d*.04 solid $stroke
  border-left: $d*.03 solid transparent
  border-right: $d*.03 solid transparent
  width: 85%
  top: 50%
  overflow: hidden
  position: absolute
  
.lens
  width: $d*.2
  height: $d*.2
  background: #295A6D
  border: $d*.03 solid $stroke
  border-radius: 50%
  position: absolute
  top: 12%
  left: 22%
  overflow: hidden
  &:after,
  &:before
    content: ''
    display: block
    width: $d*.05
    height: $d*.2
    background: rgba(255,255,255,0.2)
    position: absolute
  
  &:after
    right: 30%
    width: $d*.02
    
.cloud
  width: 230px
  height: 50px
  background: #fff
  position: absolute
  border-radius: 200px
  &:after,
  &:before
    content: ''
    display: block
    width: 130px
    height: 130px
    background: #fff
    position: absolute
    border-radius: 50%
    bottom: 0
    left: 33%
  &:before
    width: 80px
    height: 80px
    left: 10%
    bottom: 4%

.cloud-1
  right: 10%
  top: 40%
  
.cloud-2
  top: 20%
  left: 10%
  
// Keyframes
  
@-webkit-keyframes spinMove
  0%
    transform: rotate(360deg)
  100% 
    transform: rotate(0deg)
  
@-webkit-keyframes hopMove
  12%
    transform: translateY(0)
  14% 
    transform: translateY(5px)
  16%
    transform: translateY(0)
              
            
!

JS

              
                
              
            
!
999px

Console