matt HOFFNER commited on
Commit
41a73cf
β€’
1 Parent(s): 292de4b

circadian mode

Browse files
Files changed (4) hide show
  1. app/layout.tsx +1 -1
  2. app/page.module.css +4 -3
  3. app/page.tsx +1 -1
  4. app/util.ts +49 -38
app/layout.tsx CHANGED
@@ -5,7 +5,7 @@ import './globals.css'
5
  const inter = Inter({ subsets: ['latin'] })
6
 
7
  export const metadata: Metadata = {
8
- title: 'Functions Playground',
9
  description: 'Navigate to URLs and perform realtime similarity search',
10
  }
11
 
 
5
  const inter = Inter({ subsets: ['latin'] })
6
 
7
  export const metadata: Metadata = {
8
+ title: 'Web Chat',
9
  description: 'Navigate to URLs and perform realtime similarity search',
10
  }
11
 
app/page.module.css CHANGED
@@ -22,18 +22,15 @@
22
  content: '';
23
  position: absolute;
24
  top: -50%; right: -50%; bottom: -50%; left: -50%;
25
- background-image: radial-gradient(closest-side, rgba(255, 255, 255, 0.2), transparent);
26
  background-repeat: no-repeat;
27
  background-position: 50%;
28
  transform: rotate(45deg) scale(1.5);
29
- backdrop-filter: blur(30px);
30
  }
31
 
32
  .background::after {
33
  content: '';
34
  position: absolute;
35
  top: -50%; right: -50%; bottom: -50%; left: -50%;
36
- background-image: radial-gradient(closest-side, rgba(255, 255, 255, 0.2), transparent);
37
  background-repeat: no-repeat;
38
  background-position: 50%;
39
  transform: rotate(-45deg) scale(1.5);
@@ -405,3 +402,7 @@
405
  margin-right: 10px;
406
  }
407
 
 
 
 
 
 
22
  content: '';
23
  position: absolute;
24
  top: -50%; right: -50%; bottom: -50%; left: -50%;
 
25
  background-repeat: no-repeat;
26
  background-position: 50%;
27
  transform: rotate(45deg) scale(1.5);
 
28
  }
29
 
30
  .background::after {
31
  content: '';
32
  position: absolute;
33
  top: -50%; right: -50%; bottom: -50%; left: -50%;
 
34
  background-repeat: no-repeat;
35
  background-position: 50%;
36
  transform: rotate(-45deg) scale(1.5);
 
402
  margin-right: 10px;
403
  }
404
 
405
+ @keyframes moveClouds {
406
+ 0% { background-position: 0 0; }
407
+ 100% { background-position: 1000px 500px; }
408
+ }
app/page.tsx CHANGED
@@ -13,7 +13,7 @@ import { updateBackground } from './util';
13
  const Page: React.FC = () => {
14
  useEffect(() => {
15
  updateBackground();
16
- const interval = setInterval(updateBackground, 6000);
17
 
18
  return () => clearInterval(interval);
19
  }, []);
 
13
  const Page: React.FC = () => {
14
  useEffect(() => {
15
  updateBackground();
16
+ const interval = setInterval(updateBackground, 600);
17
 
18
  return () => clearInterval(interval);
19
  }, []);
app/util.ts CHANGED
@@ -8,48 +8,59 @@ export function updateBackground(): void {
8
  return;
9
  }
10
 
11
- let color1, color2, color3; // Colors for the radial gradients and background
 
12
 
13
- if (hour >= 6 && hour < 8) {
14
- // Early morning
15
- color1 = 'rgba(173, 216, 230, 0.3)';
16
- color2 = 'rgba(135, 206, 250, 0.3)';
17
- color3 = '#B0E0E6'; // Powder blue
18
- } else if (hour >= 8 && hour < 10) {
19
- // Mid-morning
20
- color1 = 'rgba(240, 230, 140, 0.3)';
21
- color2 = 'rgba(238, 232, 170, 0.3)';
22
- color3 = '#F0E68C'; // Khaki
23
- } else if (hour >= 10 && hour < 12) {
24
- // Late morning
25
- color1 = 'rgba(250, 250, 210, 0.3)';
26
- color2 = 'rgba(255, 255, 224, 0.3)';
27
- color3 = '#FFFACD'; // Lemon chiffon
28
- } else if (hour >= 12 && hour < 14) {
29
- // Early afternoon
30
- color1 = 'rgba(255, 182, 193, 0.3)';
31
- color2 = 'rgba(255, 192, 203, 0.3)';
32
- color3 = '#FFB6C1'; // Light pink
33
- } else if (hour >= 14 && hour < 16) {
34
- // Mid-afternoon
35
- color1 = 'rgba(255, 160, 122, 0.3)';
36
- color2 = 'rgba(255, 127, 80, 0.3)';
37
- color3 = '#FFA07A'; // Light salmon
38
- } else if (hour >= 16 && hour < 18) {
39
- // Late afternoon to early evening
40
- color1 = 'rgba(255, 99, 71, 0.3)';
41
- color2 = 'rgba(255, 69, 0, 0.3)';
42
- color3 = '#FF4500'; // Orange red
43
  } else {
44
  // Night
45
- color1 = 'black';
46
- color2 = 'black';
47
- color3 = '#000080'; // Navy blue for a slightly softer night effect
48
  }
49
 
50
- // Set the background image and color
 
 
 
 
 
 
 
 
 
51
  background.style.backgroundImage =
52
- `radial-gradient(circle at 20% 20%, ${color1}, transparent 70%),
53
- radial-gradient(circle at 80% 80%, ${color2}, transparent 70%)`;
54
  background.style.backgroundColor = color3;
55
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  return;
9
  }
10
 
11
+ let color1, color2, color3, color4; // Colors for the radial gradients and background
12
+ let cloudStyle = ''; // Additional style for cloud effects
13
 
14
+ if (hour >= 5 && hour < 7) {
15
+ // Dawn
16
+ color1 = 'rgba(255, 140, 0, 0.6)'; // Dark orange (sunrise)
17
+ color2 = 'rgba(135, 206, 250, 0.6)'; // Sky blue (light sky)
18
+ color3 = '#F0E68C'; // Light khaki (morning light)
19
+ } else if (hour >= 7 && hour < 17) {
20
+ // Daylight
21
+ color1 = 'rgba(135, 206, 250, 0.6)'; // Light sky blue (high sky)
22
+ color2 = 'rgba(255, 255, 255, 0.6)'; // White (sun)
23
+ color3 = '#87CEEB'; // Sky blue (clear day)
24
+ cloudStyle = ', radial-gradient(circle at 10% 30%, rgba(255, 255, 255, 0.8), transparent 80%), radial-gradient(circle at 90% 40%, rgba(255, 255, 255, 0.8), transparent 80%)';
25
+ } else if (hour >= 17 && hour < 20) {
26
+ // Dusk
27
+ color1 = 'rgba(250, 128, 114, 0.6)'; // Salmon (sunset)
28
+ color2 = 'rgba(100, 149, 237, 0.6)'; // Cornflower blue (evening sky)
29
+ color3 = '#B0C4DE'; // Light steel blue (twilight)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  } else {
31
  // Night
32
+ color1 = 'rgba(0, 0, 0, 1)'; // Pure black
33
+ color2 = 'rgba(0, 0, 0, 1)'; // Pure black
34
+ color3 = '#000000'; // Pure black
35
  }
36
 
37
+ // Define color4 for the pseudo-elements
38
+ if (hour >= 6 && hour < 18) {
39
+ // Daytime: lighter color for a subtle effect
40
+ color4 = 'rgba(255, 255, 255, 0.2)';
41
+ } else {
42
+ // Nighttime: darker color for a stronger effect
43
+ color4 = 'rgba(0, 0, 0, 0.1)';
44
+ }
45
+
46
+ // Set the background image, color, and cloud effect
47
  background.style.backgroundImage =
48
+ `radial-gradient(circle at 50% 20%, ${color1}, transparent 90%),
49
+ radial-gradient(circle at 50% 80%, ${color2}, transparent 90%)${cloudStyle}`;
50
  background.style.backgroundColor = color3;
51
+
52
+ // Cloud animation
53
+ if (cloudStyle) {
54
+ background.style.animation = 'moveClouds 60s linear infinite';
55
+ } else {
56
+ background.style.animation = 'none';
57
+ }
58
+ // Set the styles for the pseudo-elements
59
+ const beforeElement: any = document.querySelector('.background::before');
60
+ const afterElement: any = document.querySelector('.background::after');
61
+
62
+ if (beforeElement && afterElement) {
63
+ beforeElement.style.backgroundImage = `radial-gradient(closest-side, ${color4}, transparent)`;
64
+ afterElement.style.backgroundImage = `radial-gradient(closest-side, ${color4}, transparent)`;
65
+ }
66
+ }