bird0867 commited on
Commit
f3d4af6
·
verified ·
1 Parent(s): f8599cf

all of the blobs need to pick random directions to evolve their movement towards and the blobs could be a little larger and more blues and purples and pinks

Browse files
Files changed (2) hide show
  1. script.js +16 -4
  2. style.css +27 -37
script.js CHANGED
@@ -1,7 +1,21 @@
 
1
  document.addEventListener('DOMContentLoaded', function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  // Mouse move interaction
3
  document.addEventListener('mousemove', (e) => {
4
- const blobs = document.querySelectorAll('.blob');
5
  const x = e.clientX / window.innerWidth;
6
  const y = e.clientY / window.innerHeight;
7
 
@@ -21,7 +35,6 @@ document.addEventListener('DOMContentLoaded', function() {
21
  const x = touch.clientX / window.innerWidth;
22
  const y = touch.clientY / window.innerHeight;
23
 
24
- const blobs = document.querySelectorAll('.blob');
25
  blobs.forEach((blob, index) => {
26
  const moveX = (x - 0.5) * (index + 1) * 5;
27
  const moveY = (y - 0.5) * (index + 1) * 5;
@@ -31,9 +44,8 @@ document.addEventListener('DOMContentLoaded', function() {
31
 
32
  // Reset transform when mouse leaves
33
  document.addEventListener('mouseleave', () => {
34
- const blobs = document.querySelectorAll('.blob');
35
  blobs.forEach(blob => {
36
  blob.style.transform = '';
37
  });
38
  });
39
- });
 
1
+
2
  document.addEventListener('DOMContentLoaded', function() {
3
+ // Set random animation variables for each blob
4
+ const blobs = document.querySelectorAll('.blob');
5
+ blobs.forEach(blob => {
6
+ // Generate random values for translation and rotation
7
+ const tx = (Math.random() - 0.5) * 200;
8
+ const ty = (Math.random() - 0.5) * 200;
9
+ const r = (Math.random() - 0.5) * 360;
10
+
11
+ // Set CSS variables for the float animation
12
+ blob.style.setProperty('--tx', `${tx}px`);
13
+ blob.style.setProperty('--ty', `${ty}px`);
14
+ blob.style.setProperty('--r', `${r}deg`);
15
+ });
16
+
17
  // Mouse move interaction
18
  document.addEventListener('mousemove', (e) => {
 
19
  const x = e.clientX / window.innerWidth;
20
  const y = e.clientY / window.innerHeight;
21
 
 
35
  const x = touch.clientX / window.innerWidth;
36
  const y = touch.clientY / window.innerHeight;
37
 
 
38
  blobs.forEach((blob, index) => {
39
  const moveX = (x - 0.5) * (index + 1) * 5;
40
  const moveY = (y - 0.5) * (index + 1) * 5;
 
44
 
45
  // Reset transform when mouse leaves
46
  document.addEventListener('mouseleave', () => {
 
47
  blobs.forEach(blob => {
48
  blob.style.transform = '';
49
  });
50
  });
51
+ });
style.css CHANGED
@@ -1,20 +1,12 @@
1
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
2
-
3
  @keyframes float {
4
- 0%, 100% {
5
  transform: translate(0, 0) rotate(0deg);
6
  }
7
- 25% {
8
- transform: translate(20px, -20px) rotate(5deg);
9
- }
10
- 50% {
11
- transform: translate(-20px, 20px) rotate(-5deg);
12
- }
13
- 75% {
14
- transform: translate(10px, 10px) rotate(3deg);
15
  }
16
  }
17
-
18
  @keyframes morph {
19
  0% {
20
  border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%;
@@ -70,79 +62,77 @@ body {
70
  animation: float 15s infinite ease-in-out;
71
  will-change: transform;
72
  }
73
-
74
  .blob-1 {
75
- width: 500px;
76
- height: 500px;
77
- background: radial-gradient(circle, rgba(121,9,103,0.8) 0%, rgba(255,0,150,0.6) 100%);
78
  top: 10%;
79
  left: 10%;
80
  animation: morph 18s infinite ease-in-out, float 20s infinite ease-in-out;
81
  }
82
 
83
  .blob-2 {
84
- width: 400px;
85
- height: 400px;
86
- background: radial-gradient(circle, rgba(0,212,255,0.8) 0%, rgba(0,100,255,0.6) 100%);
87
  top: 20%;
88
  right: 15%;
89
  animation: morph 22s infinite ease-in-out reverse, float 25s infinite ease-in-out;
90
  }
91
 
92
  .blob-3 {
93
- width: 350px;
94
- height: 350px;
95
- background: radial-gradient(circle, rgba(0,255,150,0.8) 0%, rgba(0,200,100,0.6) 100%);
96
  bottom: 15%;
97
  left: 20%;
98
  animation: morph 20s infinite ease-in-out, float 18s infinite ease-in-out reverse;
99
  }
100
 
101
  .blob-4 {
102
- width: 450px;
103
- height: 450px;
104
- background: radial-gradient(circle, rgba(255,200,0,0.8) 0%, rgba(255,150,0,0.6) 100%);
105
  bottom: 10%;
106
  right: 10%;
107
  animation: morph 24s infinite ease-in-out reverse, float 22s infinite ease-in-out;
108
  }
109
 
110
  .blob-5 {
111
- width: 300px;
112
- height: 300px;
113
- background: radial-gradient(circle, rgba(255,0,100,0.8) 0%, rgba(200,0,100,0.6) 100%);
114
  top: 40%;
115
  left: 40%;
116
  animation: morph 16s infinite ease-in-out, float 19s infinite ease-in-out;
117
  }
118
 
119
  .blob-6 {
120
- width: 380px;
121
- height: 380px;
122
- background: radial-gradient(circle, rgba(100,100,255,0.8) 0%, rgba(50,50,200,0.6) 100%);
123
  top: 5%;
124
  right: 30%;
125
  animation: morph 26s infinite ease-in-out reverse, float 21s infinite ease-in-out;
126
  }
127
 
128
  .blob-7 {
129
- width: 320px;
130
- height: 320px;
131
- background: radial-gradient(circle, rgba(0,255,200,0.8) 0%, rgba(0,200,150,0.6) 100%);
132
  bottom: 30%;
133
  left: 5%;
134
  animation: morph 19s infinite ease-in-out, float 17s infinite ease-in-out reverse;
135
  }
136
 
137
  .blob-8 {
138
- width: 420px;
139
- height: 420px;
140
- background: radial-gradient(circle, rgba(255,100,200,0.8) 0%, rgba(200,50,150,0.6) 100%);
141
  top: 30%;
142
  right: 5%;
143
  animation: morph 23s infinite ease-in-out reverse, float 24s infinite ease-in-out;
144
  }
145
-
146
  .animate-fade-in {
147
  animation: fadeIn 1.5s ease-out forwards;
148
  }
 
1
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
 
2
  @keyframes float {
3
+ 0% {
4
  transform: translate(0, 0) rotate(0deg);
5
  }
6
+ 100% {
7
+ transform: translate(var(--tx), var(--ty)) rotate(var(--r));
 
 
 
 
 
 
8
  }
9
  }
 
10
  @keyframes morph {
11
  0% {
12
  border-radius: 40% 60% 70% 30% / 40% 40% 60% 50%;
 
62
  animation: float 15s infinite ease-in-out;
63
  will-change: transform;
64
  }
 
65
  .blob-1 {
66
+ width: 600px;
67
+ height: 600px;
68
+ background: radial-gradient(circle, rgba(121,9,103,0.8) 0%, rgba(150,0,255,0.6) 100%);
69
  top: 10%;
70
  left: 10%;
71
  animation: morph 18s infinite ease-in-out, float 20s infinite ease-in-out;
72
  }
73
 
74
  .blob-2 {
75
+ width: 500px;
76
+ height: 500px;
77
+ background: radial-gradient(circle, rgba(0,212,255,0.8) 0%, rgba(100,100,255,0.6) 100%);
78
  top: 20%;
79
  right: 15%;
80
  animation: morph 22s infinite ease-in-out reverse, float 25s infinite ease-in-out;
81
  }
82
 
83
  .blob-3 {
84
+ width: 450px;
85
+ height: 450px;
86
+ background: radial-gradient(circle, rgba(150,0,255,0.8) 0%, rgba(100,0,200,0.6) 100%);
87
  bottom: 15%;
88
  left: 20%;
89
  animation: morph 20s infinite ease-in-out, float 18s infinite ease-in-out reverse;
90
  }
91
 
92
  .blob-4 {
93
+ width: 550px;
94
+ height: 550px;
95
+ background: radial-gradient(circle, rgba(255,0,200,0.8) 0%, rgba(200,0,150,0.6) 100%);
96
  bottom: 10%;
97
  right: 10%;
98
  animation: morph 24s infinite ease-in-out reverse, float 22s infinite ease-in-out;
99
  }
100
 
101
  .blob-5 {
102
+ width: 400px;
103
+ height: 400px;
104
+ background: radial-gradient(circle, rgba(100,100,255,0.8) 0%, rgba(150,0,255,0.6) 100%);
105
  top: 40%;
106
  left: 40%;
107
  animation: morph 16s infinite ease-in-out, float 19s infinite ease-in-out;
108
  }
109
 
110
  .blob-6 {
111
+ width: 480px;
112
+ height: 480px;
113
+ background: radial-gradient(circle, rgba(0,100,255,0.8) 0%, rgba(121,9,103,0.6) 100%);
114
  top: 5%;
115
  right: 30%;
116
  animation: morph 26s infinite ease-in-out reverse, float 21s infinite ease-in-out;
117
  }
118
 
119
  .blob-7 {
120
+ width: 420px;
121
+ height: 420px;
122
+ background: radial-gradient(circle, rgba(200,0,255,0.8) 0%, rgba(150,0,200,0.6) 100%);
123
  bottom: 30%;
124
  left: 5%;
125
  animation: morph 19s infinite ease-in-out, float 17s infinite ease-in-out reverse;
126
  }
127
 
128
  .blob-8 {
129
+ width: 520px;
130
+ height: 520px;
131
+ background: radial-gradient(circle, rgba(255,0,150,0.8) 0%, rgba(200,50,150,0.6) 100%);
132
  top: 30%;
133
  right: 5%;
134
  animation: morph 23s infinite ease-in-out reverse, float 24s infinite ease-in-out;
135
  }
 
136
  .animate-fade-in {
137
  animation: fadeIn 1.5s ease-out forwards;
138
  }