Skip to content
Snippets Groups Projects
Sky.vue 2.26 KiB
Newer Older
<template>
  <div id="sky" class="absolute inset-0 h-screen">
    <div v-if="$colorMode.value !== 'dark'" id="clouds">
      <div v-for="cloud in 5" :key="cloud" :class="'x' + cloud">
        <div class="cloud" />
      </div>
    </div>

    <div v-else>
      <div class="stars absolute inset-0 h-screen z-0" />
      <div class="twinkling absolute inset-0 h-screen z-1 opacity-75" />
    </div>
  </div>
</template>

<script>
export default {}
</script>

<style lang="postcss" scoped>
#clouds {
  padding: 20vh 0;
}

/* Day */

@keyframes animateCloud {
  0% {
    margin-left: -1000px;
  }
  100% {
    margin-left: 100%;
  }
}

.x1 {
  animation: animateCloud 70s linear infinite;
  transform: scale(0.65);
}

.x2 {
  animation: animateCloud 40s linear infinite;
  transform: scale(0.3) rotateY(180deg);
}

.x3 {
  animation: animateCloud 60s linear infinite;
  transform: scale(0.5);
  opacity: 0.7;
}

.x4 {
  animation: animateCloud 36s linear infinite;
  transform: scale(0.4);
  opacity: 0.5;
}

.x5 {
  animation: animateCloud 50s linear infinite;
  transform: scale(0.55) rotateY(180deg);
  opacity: 0.4;
}

.cloud {
  background: #fff;
  border-radius: 100px;

  height: 100px;
  position: relative;
  width: 350px;
}

.cloud:after,
.cloud:before {
  background: #fff;
  content: '';
  position: absolute;
  z-index: -1;
}

.cloud:after {
  border-radius: 100px;

  height: 100px;
  left: 50px;
  top: -50px;
  width: 100px;
}

.cloud:before {
  border-radius: 200px;

  width: 180px;
  height: 180px;
  right: 50px;
  top: -90px;
}

/* Night */

@keyframes move-twink-back {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -10000px 5000px;
  }
}
@-webkit-keyframes move-twink-back {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -10000px 5000px;
  }
}
@-moz-keyframes move-twink-back {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -10000px 5000px;
  }
}
@-ms-keyframes move-twink-back {
  from {
    background-position: 0 0;
  }
  to {
    background-position: -10000px 5000px;
  }
}

.stars {
  background: black url(/particles/stars.png) repeat top center;
}

.twinkling {
  background: transparent url(/particles/twinkling.png) repeat top center;
  animation: move-twink-back 200s linear infinite;
}
</style>