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 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 class="container">
    <div class="dot"></div>
    <div class="sun"></div>
    <div class="pyramid"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
    <div class="stars"></div>
  </div>
            
          
!
            
              //Color Variables
$body-bg: #333
$skyDay: #a7ccff
$skyNight: #0b2d5c
$sand: #ffcd5d
$pyramid: #d4a63f
//Size Variables
$containerSize: 400px
$sunSize: 80px

@mixin circle($size)
  width: $size
  height: $size
  border-radius: 50%

@mixin triangle($width,$height,$color,$up:true)
  width: 0px
  border-left: $width solid transparent
  border-right: $width solid transparent
  @if $up == true
    border-top: 0 solid transparent
    border-bottom: $height solid $color
  @else
    border-bottom: 0 solid transparent
    border-top: $height solid $color

@mixin pos($top,$left)
  top: $top
  left: $left


body
  background: $body-bg

.container
  width: $containerSize
  height: $containerSize
  margin: 0 auto
  background: $skyNight
  position: relative
  overflow: hidden
  animation: DayNight 6s linear infinite
  border-radius: 50%
  top: 50px
  &::after
    content: ""
    position: absolute
    width: $containerSize
    height: $containerSize / 2
    background: $sand
    top: 60%
    z-index: 3

.dot
  position: absolute
  +pos(270px,270px)
  +circle(4px)
  background: black
  z-index: 5
.pyramid
  width: 0px
  border-top: 0 solid transparent
  +triangle(120px,130px,$pyramid)
  position: relative
  +pos(30px,170px)
  z-index: 4
  &::before
    content: ""
    position: absolute
    +triangle(120px,130px,$pyramid*2)
    border-right: 0 solid transparent
    left: -120px
    animation: changeLight 6s linear infinite
    transform-origin: bottom right
  &::after
    content: ""
    position: absolute
    width: 240px
    height: 150px
    clip-path: polygon(100% 0, 0 0, 50% 100%)
    background: $pyramid / 1.7
    +pos(130px,-120px)
    animation: Shadow 6s linear infinite

.sun
  +circle($sunSize)
  background: yellow
  transform-origin: 50px 400px
  transform: rotateZ(0deg)
  position: relative
  left: ($containerSize - $sunSize) / 2
  animation: Rising 6s linear infinite
  z-index: 3
  
.stars
  +circle(8px)
  position: relative
  +pos(0,0)
  z-index: 2
  filter: blur(.5px)
  &,&::before,&::after
    background: $skyDay
    animation: Stars 6s linear infinite
  &::before,&::after
    content: ""
    position: absolute
  &::before
    +circle(5px)
    +pos(random(100) + px,random(100) + px)
  &::after
    +circle(3px)
    +pos(random(100)+ px,random(100) + px)
@for $x from 3 through 15
  .stars:nth-child(#{$x})
    +pos((random(120)-280) + px,random(400) + px)
@keyframes Rising
  0%
    transform: rotateZ(0deg)
  100%
    transform: rotateZ(360deg)
  
@keyframes DayNight
  0%,100%
    background: $skyDay
  50%
    background: $skyNight
  
@keyframes Stars
  0%,100%
    opacity: 0
  50%
    opacity: 1

@keyframes changeLight
  0%,4%
    transform: rotateY(0deg)
  5%,10%
    transform: rotateY(180deg)
  11%,84%
    transform: rotateY(180deg)
  85%,100%
    transform: rotateY(0deg)
  
@keyframes Shadow
  0%,100%
    clip-path: polygon(100% 0, 0 0, 100% 25%)
  6%
    clip-path: polygon(100% 0, 0 0, 50% 100%)
  12%, 30%
    clip-path: polygon(100% 0, 0 0, 0% 25%)
  50%, 80%
    clip-path: polygon(100% 0, 0 0, 50% 100%)
            
          
!
            
              //   Simple css animation  
//   If you have any suggestions, please, let me know!

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

Console