ChristmasLights.vue 3.7 KB

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