ChristmasLights.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <script setup lang="ts">
  2. import { storeToRefs } from "pinia";
  3. import { useUserAuthStore } from "@/stores/userAuth";
  4. defineProps({
  5. small: { type: Boolean, default: false },
  6. lights: { type: Number, default: 1 }
  7. });
  8. const userAuthStore = useUserAuthStore();
  9. const { loggedIn } = storeToRefs(userAuthStore);
  10. </script>
  11. <template>
  12. <div
  13. :class="{
  14. 'christmas-lights': true,
  15. loggedIn,
  16. 'christmas-lights-small': small
  17. }"
  18. >
  19. <div class="christmas-wire"></div>
  20. <template v-for="n in lights" :key="n">
  21. <span class="christmas-light"></span>
  22. <div class="christmas-wire"></div>
  23. </template>
  24. </div>
  25. </template>
  26. <style lang="less" scoped>
  27. .christmas-mode {
  28. .christmas-lights {
  29. position: absolute;
  30. width: 100%;
  31. height: 64px;
  32. left: 0;
  33. top: 64px;
  34. display: flex;
  35. justify-content: space-around;
  36. overflow: hidden;
  37. pointer-events: none;
  38. &.christmas-lights-small {
  39. .christmas-light {
  40. height: 28px;
  41. width: 10px;
  42. &::before {
  43. width: 10px;
  44. height: 10px;
  45. }
  46. }
  47. }
  48. .christmas-light {
  49. height: 34px;
  50. width: 12px;
  51. border-top-left-radius: 50%;
  52. border-top-right-radius: 50%;
  53. border-bottom-left-radius: 50%;
  54. border-bottom-right-radius: 50%;
  55. z-index: 11;
  56. animation: christmas-lights 30s ease infinite;
  57. &::before {
  58. content: "";
  59. display: block;
  60. width: 12px;
  61. height: 12px;
  62. background-color: rgb(6, 49, 19);
  63. border-top-left-radius: 25%;
  64. border-top-right-radius: 25%;
  65. border-bottom-left-radius: 25%;
  66. border-bottom-right-radius: 25%;
  67. }
  68. &:nth-of-type(1) {
  69. transform: rotate(5deg);
  70. }
  71. &:nth-of-type(2) {
  72. transform: rotate(-7deg);
  73. animation-delay: -5s;
  74. }
  75. &:nth-of-type(3) {
  76. transform: rotate(3deg);
  77. animation-delay: -15s;
  78. }
  79. &:nth-of-type(4) {
  80. transform: rotate(10deg);
  81. animation-delay: -10s;
  82. }
  83. &:nth-of-type(5) {
  84. transform: rotate(-3deg);
  85. animation-delay: -20s;
  86. }
  87. &:nth-of-type(6) {
  88. transform: rotate(8deg);
  89. animation-delay: -65s;
  90. }
  91. &:nth-of-type(7) {
  92. transform: rotate(-1deg);
  93. animation-delay: -30s;
  94. }
  95. &:nth-of-type(8) {
  96. transform: rotate(-4deg);
  97. animation-delay: -75s;
  98. }
  99. &:nth-of-type(9) {
  100. transform: rotate(3deg);
  101. animation-delay: -60s;
  102. }
  103. &:nth-of-type(10) {
  104. transform: rotate(-10deg);
  105. animation-delay: -50s;
  106. }
  107. &:nth-of-type(11) {
  108. transform: rotate(7deg);
  109. animation-delay: -35s;
  110. }
  111. &:nth-of-type(12) {
  112. transform: rotate(-3deg);
  113. animation-delay: -70s;
  114. }
  115. &:nth-of-type(13) {
  116. transform: rotate(2deg);
  117. animation-delay: -25s;
  118. }
  119. &:nth-of-type(14) {
  120. transform: rotate(9deg);
  121. animation-delay: -45s;
  122. }
  123. &:nth-of-type(15) {
  124. transform: rotate(-5deg);
  125. animation-delay: -40s;
  126. }
  127. }
  128. .christmas-wire {
  129. flex: 1;
  130. margin-bottom: 15px;
  131. z-index: 10;
  132. border-top: 2px solid var(--primary-color);
  133. border-radius: 50%;
  134. margin-left: -7px;
  135. margin-right: -7px;
  136. transform: scaleY(-1);
  137. transform-origin: 0% 20%;
  138. }
  139. }
  140. }
  141. @keyframes christmas-lights {
  142. 0% {
  143. background-color: magenta;
  144. box-shadow: 0 5px 15px 3px rgba(255, 0, 255, 0.55);
  145. }
  146. 17% {
  147. background-color: cyan;
  148. box-shadow: 0 5px 15px 3px rgba(0, 255, 255, 0.55);
  149. }
  150. 34% {
  151. background-color: lime;
  152. box-shadow: 0 5px 15px 3px rgba(0, 255, 0, 0.55);
  153. }
  154. 51% {
  155. background-color: yellow;
  156. box-shadow: 0 5px 15px 3px rgba(255, 255, 0, 0.55);
  157. }
  158. 68% {
  159. background-color: orange;
  160. box-shadow: 0 5px 15px 3px rgba(255, 165, 0, 0.55);
  161. }
  162. 85% {
  163. background-color: red;
  164. box-shadow: 0 5px 15px 3px rgba(255, 0, 0, 0.55);
  165. }
  166. 100% {
  167. background-color: magenta;
  168. box-shadow: 0 5px 15px 3px rgba(255, 0, 255, 0.55);
  169. }
  170. }
  171. </style>