11<script setup lang="ts">
2- const stages = [
2+ const roundTo = (decimals : number , n : number ) =>
3+ Math .round (n * 10 ** decimals ) / 10 ** decimals
4+
5+ const logoStages = [
36 " M 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 0.5 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 L 43.9409 0 Z" ,
47 " M96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186 .5 0 43.9409 0 96.0379 101.889 96.0379 101.889 96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186 96.0308 186Z" ,
58 " M170.085 42.0683 170.085 42.0683 170.085 42.0683 170.085 42.0683 170.085 42.0683 148.365 84.5494 148.365 84.5494 96.0308 186 .5 0 43.9409 0 96.0379 101.889 148.135 0 191.576 0 170.085 42.0683 170.085 42.0683 170.085 42.0683 170.085 42.0683 170.085 42.0683Z" ,
@@ -8,15 +11,15 @@ const stages = [
811 " M311.5 186 268.059 186 218.422 86.2804 205.508 111.348 243.678 186 200.237 186 148.365 84.5494 96.0308 186 .5 0 43.9409 0 96.0379 101.889 148.135 0 191.576 0 170.085 42.0683 182.144 65.654 215.969 0 239.394 45.6091 311.5 186Z" ,
912]
1013
11- const values = computed (() => stages .join (" ;" ))
14+ const values = computed (() => logoStages .join (" ;" ))
1215
1316const keySplines = computed (() => {
14- return Array .from ({ length: stages .length - 1 }, () => " 0.87 0 0.13 1" ).join (" ;" )
17+ return Array .from ({ length: logoStages .length - 1 }, () => " 0.87 0 0.13 1" ).join (" ;" )
1518})
1619
1720const keyTimes = computed (() => {
18- const stepSize = 1 / (stages .length - 1 )
19- return Array .from ({ length: stages .length }, (_ , index ) => {
21+ const stepSize = 1 / (logoStages .length - 1 )
22+ return Array .from ({ length: logoStages .length }, (_ , index ) => {
2023 return Math .min (index * stepSize , 1 )
2124 })
2225 .map ((v ) => Math .floor (v * 100 ) / 100 )
@@ -26,30 +29,35 @@ const keyTimes = computed(() => {
2629const width = 1200
2730const height = 630
2831
29- const STAR_AMOUNT = 50
32+ const STAR_AMOUNT = 30
3033const X_SPEED = 0.125
34+ const ROUND_DECIMALS = 2
3135
3236const stars = Array .from ({ length: STAR_AMOUNT })
3337 .fill (0 )
3438 .map (() => {
3539 const star = {
3640 xStart: Math .random () * width ,
3741 xSpeed: (Math .random () * X_SPEED + X_SPEED / 2 ) * width ,
38- size: Math .random () * 2 + 0.75 ,
42+ size: Math .random () * 2 + 1.25 ,
3943 duration: (Math .random () * 0.25 + 0.05 ) * 300 ,
4044 begin: 0 ,
4145 }
4246
43- star .begin = Math .random () * (star .duration / 4 )
47+ star .begin = Math .random () * (star .duration / 3 )
4448
4549 if (Math .random () > 0.5 ) {
4650 star .xSpeed *= - 1
4751 }
4852
53+ star .xStart = roundTo (ROUND_DECIMALS , star .xStart )
54+ star .xSpeed = roundTo (ROUND_DECIMALS , star .xSpeed )
55+ star .size = roundTo (ROUND_DECIMALS , star .size )
56+ star .duration = roundTo (ROUND_DECIMALS , star .duration )
57+ star .begin = roundTo (ROUND_DECIMALS , star .begin )
58+
4959 return star
5060 })
51-
52- console .log (" test 2" )
5361 </script >
5462
5563<template >
@@ -60,114 +68,85 @@ console.log("test 2")
6068 fill =" none"
6169 xmlns =" http://www.w3.org/2000/svg"
6270 >
63- <g clip-path =" url(#clip0_174_79)" >
64- <g id =" backdrop" filter =" url(#filter0_d_174_79)" >
65- <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" black" />
66- <g opacity =" 0.75" >
67- <rect
68- x =" 25"
69- y =" 25"
70- width =" 1150"
71- height =" 580"
72- rx =" 24"
73- fill =" url(#paint0_radial_174_79)"
74- />
75- <rect
76- x =" 25"
77- y =" 25"
78- width =" 1150"
79- height =" 580"
80- rx =" 24"
81- fill =" url(#paint1_radial_174_79)"
82- />
83- <rect
84- x =" 25"
85- y =" 25"
86- width =" 1150"
87- height =" 580"
88- rx =" 24"
89- fill =" url(#paint2_radial_174_79)"
90- />
91- <rect
92- x =" 25"
93- y =" 25"
94- width =" 1150"
95- height =" 580"
96- rx =" 24"
97- fill =" url(#paint3_radial_174_79)"
98- />
99- </g >
71+ <g filter =" url(#s)" >
72+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" black" />
73+ <g opacity =" 0.75" >
74+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" url(#p0)" />
75+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" url(#p1)" />
76+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" url(#p2)" />
77+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" url(#p3)" />
10078 </g >
101- <clipPath id =" background-clip" >
102- <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" black" />
103- </clipPath >
104- <circle
105- v-for =" star in stars"
106- :key =" star.begin"
107- :opacity =" star.size / 7.5"
108- :r =" star.size"
109- fill =" white"
110- clip-path =" url(#background-clip)"
111- >
112- <animate
113- attributeName =" cy"
114- :values =" `${height}; 0`"
115- :dur =" `${star.duration}s`"
116- :begin =" `${star.begin}s`"
117- repeatCount =" indefinite"
118- />
79+ </g >
80+ <clipPath id =" background-clip" >
81+ <rect x =" 25" y =" 25" width =" 1150" height =" 580" rx =" 24" fill =" black" />
82+ </clipPath >
83+ <circle
84+ v-for =" star in stars"
85+ :key =" star.begin"
86+ :opacity =" roundTo(ROUND_DECIMALS, star.size / 7.5)"
87+ :r =" star.size"
88+ fill =" #fff"
89+ clip-path =" url(#background-clip)"
90+ >
91+ <animate
92+ attributeName =" cy"
93+ :values =" `${height}; 0`"
94+ :dur =" `${star.duration}s`"
95+ :begin =" `${star.begin}s`"
96+ repeatCount =" indefinite"
97+ />
98+ <animate
99+ attributeName =" cx"
100+ :values =" `${star.xStart}; ${roundTo(ROUND_DECIMALS, star.xStart + star.xSpeed)}`"
101+ :dur =" `${star.duration}s`"
102+ :begin =" `${star.begin}s`"
103+ repeatCount =" indefinite"
104+ />
105+ </circle >
106+ <g clip-path =" url(#background-clip)" opacity =" 0" >
107+ <!-- logo glow -->
108+ <animate
109+ attributeName =" opacity"
110+ values =" 0;0.3"
111+ dur =" 3s"
112+ begin =" 0.5s"
113+ fill =" freeze"
114+ />
115+ <rect
116+ x =" -156"
117+ y =" -176"
118+ width =" 1512"
119+ height =" 982"
120+ fill =" url(#p4)"
121+ fill-opacity =" 0.41"
122+ />
123+ <rect x =" -156" y =" -176" width =" 1512" height =" 982" fill =" url(#p5)" />
124+ </g >
125+ <svg
126+ width =" 312"
127+ height =" 186"
128+ :x =" width / 2 - 312 / 2"
129+ :y =" height / 2 - 186 / 2"
130+ viewBox =" 0 0 312 186"
131+ fill =" none"
132+ xmlns =" http://www.w3.org/2000/svg"
133+ >
134+ <path ref =" path" fill =" white" >
119135 <animate
120- attributeName =" cx"
121- :values =" `${star.xStart}; ${star.xStart + star.xSpeed}`"
122- :dur =" `${star.duration}s`"
123- :begin =" `${star.begin}s`"
124- repeatCount =" indefinite"
136+ attributeName =" d"
137+ begin =" 250ms"
138+ dur =" 750ms"
139+ fill =" freeze"
140+ calcMode =" spline"
141+ :keySplines =" keySplines"
142+ :keyTimes =" keyTimes"
143+ :values =" values"
125144 />
126- </circle >
127- <g id =" logo-glow" opacity =" 0" class =" glow-fade-in" >
128- <rect
129- x =" -156"
130- y =" -176"
131- width =" 1512"
132- height =" 982"
133- fill =" url(#paint4_radial_174_79)"
134- fill-opacity =" 0.41"
135- />
136- <rect
137- x =" -156"
138- y =" -176"
139- width =" 1512"
140- height =" 982"
141- fill =" url(#paint5_radial_174_79)"
142- />
143- </g >
144- <svg
145- id =" logo"
146- width =" 312"
147- height =" 186"
148- :x =" width / 2 - 312 / 2"
149- :y =" height / 2 - 186 / 2"
150- viewBox =" 0 0 312 186"
151- fill =" none"
152- xmlns =" http://www.w3.org/2000/svg"
153- >
154- <path ref =" path" fill =" white" >
155- <animate
156- attributeName =" d"
157- begin =" 250ms"
158- dur =" 750ms"
159- fill =" freeze"
160- calcMode =" spline"
161- :keySplines =" keySplines"
162- :keyTimes =" keyTimes"
163- :values =" values"
164- />
165- </path >
166- </svg >
167- </g >
145+ </path >
146+ </svg >
168147 <defs >
169148 <filter
170- id =" filter0_d_174_79 "
149+ id =" s "
171150 x =" 5"
172151 y =" 5"
173152 width =" 1198"
@@ -189,20 +168,11 @@ console.log("test 2")
189168 type =" matrix"
190169 values =" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"
191170 />
192- <feBlend
193- mode =" normal"
194- in2 =" BackgroundImageFix"
195- result =" effect1_dropShadow_174_79"
196- />
197- <feBlend
198- mode =" normal"
199- in =" SourceGraphic"
200- in2 =" effect1_dropShadow_174_79"
201- result =" shape"
202- />
171+ <feBlend mode =" normal" in2 =" BackgroundImageFix" result =" e1" />
172+ <feBlend mode =" normal" in =" SourceGraphic" in2 =" e1" result =" shape" />
203173 </filter >
204174 <radialGradient
205- id =" paint0_radial_174_79 "
175+ id =" p0 "
206176 cx =" 0"
207177 cy =" 0"
208178 r =" 1"
@@ -213,7 +183,7 @@ console.log("test 2")
213183 <stop offset =" 1" stop-opacity =" 0" />
214184 </radialGradient >
215185 <radialGradient
216- id =" paint1_radial_174_79 "
186+ id =" p1 "
217187 cx =" 0"
218188 cy =" 0"
219189 r =" 1"
@@ -224,7 +194,7 @@ console.log("test 2")
224194 <stop offset =" 1" stop-opacity =" 0" />
225195 </radialGradient >
226196 <radialGradient
227- id =" paint2_radial_174_79 "
197+ id =" p2 "
228198 cx =" 0"
229199 cy =" 0"
230200 r =" 1"
@@ -235,7 +205,7 @@ console.log("test 2")
235205 <stop offset =" 1" stop-opacity =" 0" />
236206 </radialGradient >
237207 <radialGradient
238- id =" paint3_radial_174_79 "
208+ id =" p3 "
239209 cx =" 0"
240210 cy =" 0"
241211 r =" 1"
@@ -246,7 +216,7 @@ console.log("test 2")
246216 <stop offset =" 1" stop-opacity =" 0" />
247217 </radialGradient >
248218 <radialGradient
249- id =" paint4_radial_174_79 "
219+ id =" p4 "
250220 cx =" 0"
251221 cy =" 0"
252222 r =" 1"
@@ -257,7 +227,7 @@ console.log("test 2")
257227 <stop offset =" 1" stop-opacity =" 0" />
258228 </radialGradient >
259229 <radialGradient
260- id =" paint5_radial_174_79 "
230+ id =" p5 "
261231 cx =" 0"
262232 cy =" 0"
263233 r =" 1"
@@ -267,24 +237,6 @@ console.log("test 2")
267237 <stop stop-color =" white" stop-opacity =" 0.43" />
268238 <stop offset =" 1" stop-opacity =" 0" />
269239 </radialGradient >
270- <clipPath id =" clip0_174_79" >
271- <rect :width =" width" :height =" height" fill =" white" />
272- </clipPath >
273240 </defs >
274241 </svg >
275242</template >
276-
277- <style scoped lang="scss">
278- .glow-fade-in {
279- animation : fade- in 2000ms forwards ;
280- animation-delay : 500ms ;
281- }
282- @keyframes fade-in {
283- from {
284- opacity : 0 ;
285- }
286- to {
287- opacity : 0.4 ;
288- }
289- }
290- </style >
0 commit comments