@@ -38,6 +38,37 @@ document.addEventListener('DOMContentLoaded', () => {
3838 lineDistance : 120 ,
3939 glowEffect : true
4040 } ;
41+ case 'matrix' :
42+ return {
43+ particleCount : 150 ,
44+ baseSizeMin : 0.6 ,
45+ baseSizeMax : 1.8 ,
46+ speedMin : 0.4 ,
47+ speedMax : 1.4 ,
48+ opacityMin : 0.4 ,
49+ opacityMax : 0.9 ,
50+ useHue : false ,
51+ fixedHue : 120 ,
52+ connectLines : false ,
53+ glowEffect : true ,
54+ verticalFall : true
55+ } ;
56+ case 'sunset' :
57+ return {
58+ particleCount : 90 ,
59+ baseSizeMin : 1 ,
60+ baseSizeMax : 2.6 ,
61+ speedMin : - 0.18 ,
62+ speedMax : 0.18 ,
63+ opacityMin : 0.3 ,
64+ opacityMax : 0.7 ,
65+ useHue : true ,
66+ hueMin : 10 ,
67+ hueMax : 45 ,
68+ connectLines : true ,
69+ lineDistance : 110 ,
70+ glowEffect : true
71+ } ;
4172 default : // default
4273 return {
4374 particleCount : 50 ,
@@ -70,15 +101,25 @@ document.addEventListener('DOMContentLoaded', () => {
70101 if ( themeProps . useHue ) {
71102 this . hue = Math . random ( ) * ( themeProps . hueMax - themeProps . hueMin ) + themeProps . hueMin ;
72103 } else {
73- this . hue = 0 ; // nieużywane dla space
104+ this . hue = themeProps . fixedHue || 0 ; // np. zielony dla matrix, biały dla space
74105 }
75106 this . glow = themeProps . glowEffect ;
107+ if ( themeProps . verticalFall ) {
108+ this . speedX = 0 ;
109+ this . speedY = Math . random ( ) * ( themeProps . speedMax - themeProps . speedMin ) + themeProps . speedMin ;
110+ }
76111 }
77112
78113 update ( themeProps , mouse ) {
79114 this . x += this . speedX ;
80115 this . y += this . speedY ;
81116
117+ // Motyw matrix: cząstki spadają i wracają na górę
118+ if ( themeProps . verticalFall && this . y > canvas . height ) {
119+ this . y = 0 ;
120+ this . x = Math . random ( ) * canvas . width ;
121+ }
122+
82123 // Spadek rozmiaru/opacity tylko dla domyślnego motywu
83124 if ( currentTheme === 'default' ) {
84125 if ( this . size > 0.5 ) this . size -= 0.003 ;
@@ -106,14 +147,19 @@ document.addEventListener('DOMContentLoaded', () => {
106147 draw ( ctx ) {
107148 if ( this . themeProps . useHue ) {
108149 ctx . fillStyle = `hsla(${ this . hue } , 70%, 60%, ${ this . opacity } )` ;
150+ } else if ( this . themeProps . fixedHue ) {
151+ // Dla matrix: zielone cząstki
152+ ctx . fillStyle = `hsla(${ this . hue } , 90%, 55%, ${ this . opacity } )` ;
109153 } else {
110154 // Dla space: białe cząstki
111155 ctx . fillStyle = `hsla(0, 0%, 100%, ${ this . opacity } )` ;
112156 }
113157
114158 if ( this . glow ) {
115159 ctx . shadowBlur = 6 ;
116- ctx . shadowColor = this . themeProps . useHue ? `hsl(${ this . hue } , 80%, 60%)` : 'white' ;
160+ ctx . shadowColor = this . themeProps . useHue
161+ ? `hsl(${ this . hue } , 80%, 60%)`
162+ : ( this . themeProps . fixedHue ? `hsl(${ this . hue } , 90%, 55%)` : 'white' ) ;
117163 } else {
118164 ctx . shadowBlur = 0 ;
119165 }
@@ -183,15 +229,19 @@ document.addEventListener('DOMContentLoaded', () => {
183229
184230 // --- Theme Toggle (3 motywy) ---
185231 const themeToggle = document . getElementById ( 'themeToggle' ) ;
186- const themes = [ 'default' , 'space' , 'cyber' ] ;
232+ const themes = [ 'default' , 'space' , 'cyber' , 'matrix' , 'sunset' ] ;
187233
188234 function applyTheme ( theme ) {
189235 currentTheme = theme ;
190- document . body . classList . remove ( 'space-theme' , 'cyber-theme' ) ;
236+ document . body . classList . remove ( 'space-theme' , 'cyber-theme' , 'matrix-theme' , 'sunset-theme' ) ;
191237 if ( theme === 'space' ) {
192238 document . body . classList . add ( 'space-theme' ) ;
193239 } else if ( theme === 'cyber' ) {
194240 document . body . classList . add ( 'cyber-theme' ) ;
241+ } else if ( theme === 'matrix' ) {
242+ document . body . classList . add ( 'matrix-theme' ) ;
243+ } else if ( theme === 'sunset' ) {
244+ document . body . classList . add ( 'sunset-theme' ) ;
195245 }
196246 initParticles ( ) ;
197247 localStorage . setItem ( 'theme' , theme ) ;
0 commit comments