cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

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.

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.

            
              - 'use strict'
- const logs = 7
- const streaks = 10
- const sticks = 4
- const sparks = 8
- const flames = 7
.stage
  .campfire
    .sparks
      each spark in Array(sparks)
        .spark
    .logs
      each log in Array(logs)
        .log
          each streak in Array(streaks)
            .streak
    .sticks
      each stick in Array(sticks)
        .stick
    .fire
      .fire__red
        each flame in Array(flames)
          .flame
      .fire__orange
        each flame in Array(flames)
          .flame
      .fire__yellow
        each flame in Array(flames - 2)
          .flame
      .fire__white
        each flame in Array(flames)
          .flame
            
          
!
            
              // colors
$page-background = radial-gradient(#550d39, #270537)

$wood = #781e20
$light-wood = #b35050

$red-flame = saturate(#ce1e04, 20%)
$orange-flame = saturate(#fd980f, 20%)
$yellow-flame = saturate(#fde37b, 20%)
$white-flame = saturate(#fef1d9, 0)

// measurements
$scale = 1

$fire-duration = 2s

$campfire-size = 600px

$rings = 7
$log-ring-small = 2.5px * $scale
$log-ring-large = 8px * $scale

$streak-rows = 5
$streak-gap = 10px * $scale
$streak-height = 2px * $scale
$streak-border-radius = 20px * $scale

$log-width = 238px * $scale
$log-height = ($streak-gap * ($streak-rows + 1)) + ($streak-height * $streak-rows)
$log-border-radius = 32px * $scale

$stick-width = 68px * $scale
$stick-height = 20px * $scale
$stick-border-radius = 10px * $scale

$flame-width = 48px * $scale
$flame-offset = 138px * $scale

$small-flame-width = 32px * $scale

$spark-width = 6px * $scale
$spark-height = 20px * $scale
$spark-border-radius = 18px * $scale

// functions
grayscale(n)
  if (n >= 0)
    rgba(255, 255, 255, n / 100)
  else
    rgba(0, 0, 0, n / 100)

html
body
  width 100%
  height 100%
  margin 0
  padding 0
  background $page-background
  
.stage
  width 100%
  height 100%
  
  display flex
  align-items center
  justify-content center
  
.campfire
  position relative
  
  width $campfire-size
  height @width
  transform-origin center center
  transform scale(0.75)
  
.log
  position absolute
  
  width $log-width
  height $log-height
  
  border-radius $log-border-radius
  
  background $wood
  overflow hidden
  
  // create new z-stacking context
  opacity 0.99
  
  &:before
    content ''
    display block
    position absolute
    
    top 50%
    left ($log-height / 2)
    
    width $log-ring-large
    height @width
    
    border-radius $log-border-radius
    
    background $light-wood
    
    transform translate(-50%, -50%)
    
    z-index 3
    
    box-shadow 0 0 0 $log-ring-small $wood,
               0 0 0 ($log-ring-small + $log-ring-large) $light-wood,
               0 0 0 ($log-ring-small * 2 + $log-ring-large) $wood,
               0 0 0 ($log-ring-small * 2 + $log-ring-large * 2) $light-wood,
               0 0 0 ($log-ring-small * 3 + $log-ring-large * 2) $wood,
               0 0 0 ($log-ring-small * 3 + $log-ring-large * 3) $light-wood
               
.streak
  position absolute
  height $streak-height
  border-radius $streak-border-radius
  background $light-wood
  
  // top row
  &:nth-child(1)
    top $streak-gap
    width 90px
    
  &:nth-child(2)
    top $streak-gap
    left (90px + $streak-gap)
    width 80px
    
  &:nth-child(3)
    top $streak-gap
    left (90px + 80px + $streak-gap * 2)
    width 30px
    
  // second row
  &:nth-child(4)
    top ($streak-gap * 2 + $streak-height)
    width 132px
    
  &:nth-child(5)
    top ($streak-gap * 2 + $streak-height)
    left (132px + $streak-gap)
    width 48px
    
  &:nth-child(6)
    top ($streak-gap * 2 + $streak-height)
    left (132px + 48px + $streak-gap * 2)
    width 28px
    
  // third row
  &:nth-child(7)
    top ($streak-gap * 3 + $streak-height * 2)
    left ($log-height + 4px)
    width 160px
    
  // fourth row
  &:nth-child(8)
    top ($streak-gap * 4 + $streak-height * 3)
    left 110px
    width 40px
    
  &:nth-child(9)
    top ($streak-gap * 4 + $streak-height * 3)
    left (110px + 40px + $streak-gap * 2)
    width 54px
    
  // fifth row
  &:nth-child(10)
    top ($streak-gap * 5 + $streak-height * 4)
    left 90px
    width 110px
    
.log
  transform-origin center center
  box-shadow 0 0 2px 1px rgba(0, 0, 0, 0.15)
  
  &:nth-child(1)
    bottom 100px
    left 100px
    transform rotate(150deg) scaleX(0.75)
    
    z-index 20
    
  &:nth-child(2)
    bottom 120px
    left 140px
    transform rotate(110deg) scaleX(0.75)
    
    z-index 10
    
  &:nth-child(3)
    bottom 98px
    left 68px
    transform rotate(-10deg) scaleX(0.75)
    
  &:nth-child(4)
    bottom 80px
    left 220px
    transform rotate(-120deg) scaleX(0.75)
    z-index 26
    
  &:nth-child(5)
    bottom 75px
    left 210px
    transform rotate(-30deg) scaleX(0.75)
    
    z-index 25
    
  &:nth-child(6)
    bottom 92px
    left 280px
    transform rotate(35deg) scaleX(0.85)
    
    z-index 30
    
  &:nth-child(7)
    bottom 70px
    left 300px
    transform rotate(-30deg) scaleX(0.75)
    
    z-index 20
    
.stick
  position absolute
  width $stick-width
  height $stick-height
  border-radius $stick-border-radius
  box-shadow 0 0 2px 1px rgba(0, 0, 0, 0.1)
  
  background $wood
  
  &:before
    content ''
    display block
    position absolute
    bottom 100%
    left (30px * $scale)
    width (6px * $scale)
    height (20px * $scale)
    background $wood
    border-radius $stick-border-radius
    transform translateY(50%) rotate(32deg)
    
  &:after
    content ''
    display block
    position absolute
    top 0
    right 0
    width $stick-height
    height @width
    background $light-wood
    border-radius $stick-border-radius
    
.stick
  transform-origin center center

  &:nth-child(1)
    left 158px
    bottom 164px
    
    transform rotate(-152deg) scaleX(0.8)
    
    z-index 12
    
  &:nth-child(2)
    left 180px
    bottom 30px
    
    transform rotate(20deg) scaleX(0.9)
    
  &:nth-child(3)
    left 400px
    bottom 38px
    
    transform rotate(170deg) scaleX(0.9)
    
    &:before
      display none
      
  &:nth-child(4)
    left 370px
    bottom 150px
    transform rotate(80deg) scaleX(0.9)
    
    z-index 20
    
    &:before
      display none
      
.fire
  .flame
    position absolute
    transform-origin bottom center
    opacity 0.9
    
  &__red
    .flame
      width $flame-width
      border-radius $flame-width
      background $red-flame
      box-shadow 0 0 80px 18px rgba($red-flame, 0.4)
      
      &:nth-child(1)
        left $flame-offset
        height 160px
        bottom 100px
        animation fire $fire-duration 0.15s ease-in-out infinite alternate
        
      &:nth-child(2)
        left ($flame-offset + $flame-width)
        height 240px
        bottom 100px
        animation fire $fire-duration 0.35s ease-in-out infinite alternate
        
      &:nth-child(3)
        left ($flame-offset + $flame-width * 2)
        height 300px
        bottom 100px
        animation fire $fire-duration 0.1s ease-in-out infinite alternate
        
      &:nth-child(4)
        left ($flame-offset + $flame-width * 3)
        height 360px
        bottom 100px
        animation fire $fire-duration 0s ease-in-out infinite alternate
        
      &:nth-child(5)
        left ($flame-offset + $flame-width * 4)
        height 310px
        bottom 100px
        animation fire $fire-duration 0.45s ease-in-out infinite alternate
        
      &:nth-child(6)
        left ($flame-offset + $flame-width * 5)
        height 232px
        bottom 100px
        animation fire $fire-duration 0.3s ease-in-out infinite alternate
        
      &:nth-child(7)
        left ($flame-offset + $flame-width * 6)
        height 140px
        bottom 100px
        animation fire $fire-duration 0.1s ease-in-out infinite alternate
    
  &__orange
    .flame
      width $flame-width
      border-radius $flame-width
      background $orange-flame
      box-shadow 0 0 80px 18px rgba($orange-flame, 0.4)
      
      &:nth-child(1)
        left $flame-offset
        height 140px
        bottom 100px
        animation fire $fire-duration 0.05s ease-in-out infinite alternate
        
      &:nth-child(2)
        left ($flame-offset + $flame-width)
        height 210px
        bottom 100px
        animation fire $fire-duration 0.1s ease-in-out infinite alternate
        
      &:nth-child(3)
        left ($flame-offset + $flame-width * 2)
        height 250px
        bottom 100px
        animation fire $fire-duration 0.35s ease-in-out infinite alternate
        
      &:nth-child(4)
        left ($flame-offset + $flame-width * 3)
        height 300px
        bottom 100px
        animation fire $fire-duration 0.4s ease-in-out infinite alternate
        
      &:nth-child(5)
        left ($flame-offset + $flame-width * 4)
        height 260px
        bottom 100px
        animation fire $fire-duration 0.5s ease-in-out infinite alternate
        
      &:nth-child(6)
        left ($flame-offset + $flame-width * 5)
        height 202px
        bottom 100px
        animation fire $fire-duration 0.35s ease-in-out infinite alternate
        
      &:nth-child(7)
        left ($flame-offset + $flame-width * 6)
        height 110px
        bottom 100px
        animation fire $fire-duration 0.1s ease-in-out infinite alternate
    
  &__yellow
    .flame
      width $flame-width
      border-radius $flame-width
      background $yellow-flame
      box-shadow 0 0 80px 18px rgba($yellow-flame, 0.4)
      
      &:nth-child(1)
        left ($flame-offset + $flame-width)
        height 140px
        bottom 100px
        animation fire $fire-duration 0.6s ease-in-out infinite alternate
        
      &:nth-child(2)
        left ($flame-offset + $flame-width * 2)
        height 172px
        bottom 120px
        animation fire $fire-duration 0.4s ease-in-out infinite alternate
        
      &:nth-child(3)
        left ($flame-offset + $flame-width * 3)
        height 240px
        bottom 100px
        animation fire $fire-duration 0.38s ease-in-out infinite alternate
        
      &:nth-child(4)
        left ($flame-offset + $flame-width * 4)
        height 200px
        bottom 100px
        animation fire $fire-duration 0.22s ease-in-out infinite alternate
        
      &:nth-child(5)
        left ($flame-offset + $flame-width * 5)
        height 142px
        bottom 100px
        animation fire $fire-duration 0.18s ease-in-out infinite alternate

  &__white
    .flame
      width $flame-width
      border-radius $flame-width
      background $white-flame
      box-shadow 0 0 80px 18px rgba($white-flame, 0.4)
      
      &:nth-child(1)
        left $flame-offset + (18px * $scale)
        width $small-flame-width
        height 100px
        bottom 100px
        animation fire $fire-duration 0.22s ease-in-out infinite alternate
        
      &:nth-child(2)
        left ($flame-offset + $flame-width - (5px * $scale))
        width $small-flame-width
        height 120px
        bottom 100px
        animation fire $fire-duration 0.42s ease-in-out infinite alternate
        
      &:nth-child(3)
        left ($flame-offset + $flame-width * 2)
        height 170px
        bottom 100px
        animation fire $fire-duration 0.32s ease-in-out infinite alternate
        
      &:nth-child(4)
        left ($flame-offset + $flame-width * 3)
        height 210px
        bottom 100px
        animation fire $fire-duration 0.8s ease-in-out infinite alternate
        
      &:nth-child(5)
        left ($flame-offset + $flame-width * 4)
        height 170px
        bottom 100px
        animation fire $fire-duration 0.85s ease-in-out infinite alternate
        
      &:nth-child(6)
        left ($flame-offset + $flame-width * 5)
        width $small-flame-width
        height 110px
        bottom 100px
        animation fire $fire-duration 0.64s ease-in-out infinite alternate
        
      &:nth-child(7)
        left ($flame-offset + $flame-width * 6 - (18px * $scale))
        width $small-flame-width
        height 100px
        bottom 100px
        animation fire $fire-duration 0.32s ease-in-out infinite alternate
        
.spark
  position absolute
  width $spark-width
  height $spark-height
  background $white-flame
  border-radius $spark-border-radius
  z-index 50
  transform-origin bottom center
  transform scaleY(0)
  
  &:nth-child(1)
    left 160px
    bottom 212px
    animation spark 1s 0.4s linear infinite
    
  &:nth-child(2)
    left 180px
    bottom 240px
    animation spark 1s 1s linear infinite
    
  &:nth-child(3)
    left 208px
    bottom 320px
    animation spark 1s 0.8s linear infinite
    
  &:nth-child(4)
    left 310px
    bottom 400px
    animation spark 1s 2s linear infinite
    
  &:nth-child(5)
    left 360px
    bottom 380px
    animation spark 1s 0.75s linear infinite
    
  &:nth-child(6)
    left 390px
    bottom 320px
    animation spark 1s 0.65s linear infinite
    
  &:nth-child(7)
    left 400px
    bottom 280px
    animation spark 1s 1s linear infinite
    
  &:nth-child(8)
    left 430px
    bottom 210px
    animation spark 1s 1.4s linear infinite
        
@keyframes fire
  0%
    transform scaleY(1)
  28%
    transform scaleY(0.7)
  38%
    transform scaleY(0.8)
  50%
    transform scaleY(0.6)
  70%
    transform scaleY(0.95)
  82%
    transform scaleY(0.58)
  100%
    transform scaleY(1)
    
@keyframes spark
  0%
  35%
    transform scaleY(0) translateY(0)
    opacity 0
  50%
    transform scaleY(1) translateY(0)
    opacity 1
  70%
    transform scaleY(1) translateY(-10px)
    opacity 1
  75%
    transform scaleY(1) translateY(-10px)
    opacity 0
  100%
    transform scaleY(0) translateY(0)
    opacity 0

            
          
!
999px
Loading ..................

Console