-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
446 lines (410 loc) · 20.8 KB
/
Copy pathindex.html
File metadata and controls
446 lines (410 loc) · 20.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Chenhang Cui — PhD Student, NUS</title>
<meta name="description" content="Chenhang Cui — PhD student at the National University of Singapore. Research on trustworthy and aligned vision-language models." />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<canvas id="bg-canvas"></canvas>
<nav class="nav">
<div class="nav-inner">
<a href="#top" class="brand">CC<span>.</span></a>
<div class="nav-links">
<a href="#about">About</a>
<a href="#news">News</a>
<a href="#publications">Publications</a>
<a href="#experience">Experience</a>
<a href="#contact">Contact</a>
</div>
<button id="theme-toggle" aria-label="Toggle theme"><i class="fa-regular fa-moon"></i></button>
</div>
</nav>
<header id="top" class="hero">
<div class="hero-inner">
<div class="hero-text">
<p class="kicker"><span class="dot"></span> First-Year PhD · NExT++ Lab, National University of Singapore</p>
<h1>Chenhang <span class="grad">Cui</span></h1>
<p class="tagline">
Probing <b>latent knowledge</b> inside large foundation models and building <b>capable agents</b> on top of them.
</p>
<p class="bio">
I am a first-year PhD student at the <a href="https://www.nextcenter.org/" target="_blank" rel="noopener">NExT++ Research Centre</a>,
<a href="https://www.comp.nus.edu.sg/" target="_blank" rel="noopener">School of Computing, NUS</a>,
advised by Prof. <a href="https://www.chuatatseng.com/" target="_blank" rel="noopener">Chua Tat-Seng</a>,
working closely with Dr. <a href="https://feishen29.github.io/" target="_blank" rel="noopener">Fei Shen</a>.
</p>
<p class="bio">
Before starting my PhD, I interned at NExT++ with Dr. <a href="https://anzhang314.github.io/" target="_blank" rel="noopener">An Zhang</a>,
and worked as a research intern with Prof. <a href="https://www.huaxiuyao.io/" target="_blank" rel="noopener">Huaxiu Yao</a> at UNC.
I received my B.Eng. (Honors) from <a href="https://en.uestc.edu.cn/" target="_blank" rel="noopener">UESTC</a>,
where I was advised by Prof. <a href="https://yazhou-ren.github.io/" target="_blank" rel="noopener">Yazhou Ren</a>.
</p>
<p class="bio">
My current research centers on <b>latent knowledge & interpretability</b> of large foundation models
(neuron-level mechanisms, cross-modal transfer) and <b>autonomous LLM/VLM agents</b>.
I am also broadly interested in trustworthy LFMs and multi-view representation learning.
</p>
<div class="cta">
<a class="btn primary" href="CV_cch.pdf" target="_blank"><i class="fa-regular fa-file-pdf"></i> Curriculum Vitae</a>
<a class="btn" href="https://scholar.google.com/citations?user=V5X1gdAAAAAJ&hl=en" target="_blank" rel="noopener"><i class="fa-solid fa-graduation-cap"></i> Google Scholar</a>
<a class="btn" href="https://github.com/chenhangcuisg-code" target="_blank" rel="noopener"><i class="fa-brands fa-github"></i> GitHub</a>
<a class="btn" href="mailto:chenhangcui@gmail.com"><i class="fa-regular fa-envelope"></i> Email</a>
</div>
</div>
<div class="hero-card">
<div class="avatar-ring">
<div class="avatar"><img src="avatar.jpg" alt="Chenhang Cui" /></div>
</div>
<ul class="quick-facts">
<li><i class="fa-solid fa-location-dot"></i> Singapore</li>
<li><i class="fa-solid fa-building-columns"></i> NUS · NExT++ Lab</li>
<li><i class="fa-solid fa-flask"></i> Trustworthy VLMs · RL Alignment</li>
<li><i class="fa-solid fa-language"></i> 中文 / English</li>
</ul>
</div>
</div>
</header>
<section id="about" class="section">
<h2><span class="hash">#</span> Research Interests</h2>
<div class="cards cards-4">
<div class="card">
<div class="card-icon"><i class="fa-solid fa-robot"></i></div>
<h3>Agents</h3>
<p>Autonomous LLM/VLM agents — tool use, reasoning, planning, and multi-agent collaboration.</p>
</div>
<div class="card">
<div class="card-icon"><i class="fa-solid fa-brain"></i></div>
<h3>Latent Knowledge</h3>
<p>Interpretability of large models: neuron-level mechanisms, cross-modal transfer, and internal representations.</p>
</div>
<div class="card">
<div class="card-icon"><i class="fa-solid fa-shield-halved"></i></div>
<h3>Trustworthy LFMs</h3>
<p>Hallucination, jailbreak, safety alignment, and robustness of large foundation models.</p>
</div>
<div class="card">
<div class="card-icon"><i class="fa-solid fa-layer-group"></i></div>
<h3>Representation Learning</h3>
<p>Multi-view & multimodal representation learning — consistency, complementarity, and cross-architecture transfer.</p>
</div>
</div>
</section>
<section id="news" class="section">
<h2><span class="hash">#</span> News</h2>
<ul class="news">
<li>
<span class="date">2026.01</span>
<span>Started my PhD at the <b>NExT++ Lab</b>, School of Computing, NUS, advised by Prof. Chua Tat-Seng.</span>
</li>
<li>
<span class="date">2024.01</span>
<span>Received the <b>SenseTime Scholarship</b> (top 25 nationwide).</span>
</li>
</ul>
</section>
<section id="publications" class="section">
<h2><span class="hash">#</span> Selected Publications</h2>
<p class="muted">* denotes equal contribution. Full list on <a href="https://scholar.google.com/citations?user=V5X1gdAAAAAJ&hl=en" target="_blank" rel="noopener">Google Scholar</a>.</p>
<h3 class="pub-group">First-author & Co-first-author</h3>
<article class="pub">
<div class="venue">CVPR-F<br><span>2026</span></div>
<div class="pub-body">
<h3><a href="https://github.com/chenhangcuisg-code/Do-LLMs-VLMs-Share-Neurons" target="_blank" rel="noopener">Do LLMs and VLMs Share Neurons for Inference? Evidence and Mechanisms of Cross-Modal Transfer</a></h3>
<p class="authors"><b>Chenhang Cui</b>, An Zhang, Yuxin Chen, Gelei Deng, Jingnan Zheng, Zhenkai Liang, Xiang Wang, Tat-Seng Chua</p>
</div>
</article>
<article class="pub">
<div class="venue">ICML<br><span>2026</span></div>
<div class="pub-body">
<h3><a href="https://github.com/chenhangcuisg-code/Cross-Architecture-Merging-for-Large-Language-Models" target="_blank" rel="noopener">Transport and Merge: Cross-Architecture Merging for Large Language Models</a></h3>
<p class="authors"><b>Chenhang Cui</b>, Binyun Yang, Fei Shen, Yuxin Chen, Jingnan Zheng, Xiang Wang, An Zhang, Tat-Seng Chua</p>
</div>
</article>
<article class="pub">
<div class="venue">NeurIPS<br><span>2025</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2411.11496" target="_blank" rel="noopener">Safe + Safe = Unsafe? Exploring How Safe Images Can Be Exploited to Jailbreak Large Vision-Language Models</a></h3>
<p class="authors"><b>Chenhang Cui</b>, Gelei Deng, An Zhang, Yicong Li, Lianli Gao, Tianwei Zhang, Tat-Seng Chua</p>
</div>
</article>
<article class="pub">
<div class="venue">arXiv<br><span>2025</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/abs/2508.03469" target="_blank" rel="noopener">Fading Focus: Mitigating Visual Attention Degradation in Large Vision-Language Models</a></h3>
<p class="authors"><b>Chenhang Cui</b>, Jiabing Yang, Yiyang Zhou, Peng Xia, Ying Wei, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">ICLR<br><span>2025</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2410.14148.pdf" target="_blank" rel="noopener">Fine-Grained Verifiers: Preference Modeling as Next-Token Prediction in Vision-Language Alignment</a></h3>
<p class="authors"><b>Chenhang Cui</b>, An Zhang, Yiyang Zhou, Zhaorun Chen, Gelei Deng, Huaxiu Yao, Tat-Seng Chua</p>
</div>
</article>
<article class="pub">
<div class="venue">ECCV<br><span>2024</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2311.16101.pdf" target="_blank" rel="noopener">How Many Are in This Image? A Safety Evaluation Benchmark for Vision LLMs</a></h3>
<p class="authors">Haoqin Tu*, <b>Chenhang Cui*</b>, Zijun Wang*, Yiyang Zhou, Bingchen Zhao, Junlin Han, Wangchunshu Zhou, Huaxiu Yao, Cihang Xie</p>
</div>
</article>
<article class="pub">
<div class="venue">ICLR<br><span>2024</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2310.00754.pdf" target="_blank" rel="noopener">Analyzing and Mitigating Object Hallucination in Large Vision-Language Models</a></h3>
<p class="authors">Yiyang Zhou*, <b>Chenhang Cui*</b>, Jaehong Yoon, Linjun Zhang, Zhun Deng, Chelsea Finn, Mohit Bansal, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">ICLR-W<br><span>2024</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2402.11411" target="_blank" rel="noopener">Aligning Modalities in Vision Large Language Models via Preference Fine-tuning</a></h3>
<p class="authors">Yiyang Zhou*, <b>Chenhang Cui*</b>, Rafael Rafailov, Chelsea Finn, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">NeurIPS<br><span>2023</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2309.13989.pdf" target="_blank" rel="noopener">A Novel Approach for Effective Multi-View Clustering with Information-Theoretic Perspective</a></h3>
<p class="authors"><b>Chenhang Cui</b>, Yazhou Ren, Jingyu Pu, Jiawei Li, Xiaorong Pu, Tianyi Wu, Yutao Shi, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">IJCAI<br><span>2023</span></div>
<div class="pub-body">
<h3><a href="https://www.ijcai.org/proceedings/2023/0398.pdf" target="_blank" rel="noopener">Deep Multi-view Subspace Clustering with Anchor Graph</a></h3>
<p class="authors"><b>Chenhang Cui</b>, Yazhou Ren, Jingyu Pu, Xiaorong Pu, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">arXiv<br><span>2023</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2311.03287.pdf" target="_blank" rel="noopener">Holistic Analysis of Hallucination in Large Vision-Language Models: Bias and Interference Challenges</a></h3>
<p class="authors"><b>Chenhang Cui*</b>, Yiyang Zhou*, Xiangyu Yang, Shirley Wu, Linjun Zhang, James Zou, Huaxiu Yao</p>
</div>
</article>
<h3 class="pub-group">Co-author</h3>
<article class="pub">
<div class="venue">TPAMI<br><span>2026</span></div>
<div class="pub-body">
<h3>Enhancing Multi-View Clustering: A Sufficient Information-Theoretic Approach</h3>
<p class="authors">Yazhou Ren, Zichen Wen, Junlong Ke, <b>Chenhang Cui</b>, Yonghao Huang, Xinyue Chen, Philip S. Yu, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">NeurIPS<br><span>2026</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/abs/2506.07736" target="_blank" rel="noopener">RSafe: Incentivizing Proactive Reasoning to Build Robust and Adaptive LLM Safeguards</a></h3>
<p class="authors">Xiangtian Ji, Yijun Lu, <b>Chenhang Cui</b>, Weixiang Zhao, Gelei Deng, Zhenkai Liang, An Zhang, Tat-Seng Chua</p>
</div>
</article>
<article class="pub">
<div class="venue">ICCV<br><span>2025</span></div>
<div class="pub-body">
<h3>VFlowOpt: A Token Pruning Framework for LMMs with Visual Information Flow-Guided Optimization</h3>
<p class="authors">Sihan Yang, Runsen Xu, <b>Chenhang Cui</b>, Tai Wang, Dahua Lin, Jiangmiao Pang</p>
</div>
</article>
<article class="pub">
<div class="venue">EMNLP-F<br><span>2025</span></div>
<div class="pub-body">
<h3>Improving Alignment in LVLMs with Debiased Self-Judgment</h3>
<p class="authors">Sihan Yang, <b>Chenhang Cui</b>, Zihao Zhao, Yiyang Zhou, Weilong Yan, Ying Wei, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">TMLR<br><span>2025</span></div>
<div class="pub-body">
<h3>Reliable and Responsible Foundation Models</h3>
<p class="authors">Xinyu Yang, Junlin Han, Rishi Bommasani, Jinqi Luo, Wenjie Qu, Wangchunshu Zhou, Adel Bibi, Xiyao Wang, Jaehong Yoon, ..., <b>Chenhang Cui</b>, et al., Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">ICLR<br><span>2025</span></div>
<div class="pub-body">
<h3><a href="https://arxiv.org/pdf/2410.10139" target="_blank" rel="noopener">MMIE: Massive Multimodal Interleaved Comprehension Benchmark for Large Vision-Language Models</a></h3>
<p class="authors">Peng Xia, Siwei Han, Shi Qiu, Yiyang Zhou, Zhaoyang Wang, Wenhao Zheng, Zhaorun Chen, <b>Chenhang Cui</b>, Mingyu Ding, Linjie Li, Lijuan Wang, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">NeurIPS<br><span>2024</span></div>
<div class="pub-body">
<h3>Calibrated Self-Rewarding Vision Language Models</h3>
<p class="authors">Yiyang Zhou, Zhiyuan Fan, Dongjie Cheng, Sihan Yang, Zhaorun Chen, <b>Chenhang Cui</b>, Xiyao Wang, Yun Li, Linjun Zhang, Huaxiu Yao</p>
</div>
</article>
<article class="pub">
<div class="venue">AAAI<br><span>2024</span></div>
<div class="pub-body">
<h3><a href="https://ojs.aaai.org/index.php/AAAI/article/download/29380/30606" target="_blank" rel="noopener">Adaptive Feature Imputation with Latent Graph for Deep Incomplete Multi-View Clustering</a></h3>
<p class="authors">Jingyu Pu, <b>Chenhang Cui</b>, Xinyue Chen, Yazhou Ren, Xiaorong Pu, Zhifeng Hao, S. Yu Philip, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">ICML-W<br><span>2024</span></div>
<div class="pub-body">
<h3><a href="https://openreview.net/pdf?id=H6eELDnYvd" target="_blank" rel="noopener">MJ-Bench: Is Your Multimodal Reward Model Really a Good Judge?</a></h3>
<p class="authors">Zhaorun Chen, Yichao Du, Zichen Wen, Yiyang Zhou, <b>Chenhang Cui</b>, et al.</p>
</div>
</article>
<article class="pub">
<div class="venue">IJCAI<br><span>2024</span></div>
<div class="pub-body">
<h3>Dynamic Weighted Graph Fusion for Deep Multi-View Clustering</h3>
<p class="authors">Yazhou Ren, Jingyu Pu, <b>Chenhang Cui</b>, Yan Zheng, Xinyue Chen, Xiaorong Pu, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">IJCAI<br><span>2024</span></div>
<div class="pub-body">
<h3>Integrating Vision-Language Semantic Graphs in Multi-View Clustering</h3>
<p class="authors">Junlong Ke, Zichen Wen, Yechenhao Yang, <b>Chenhang Cui</b>, Yazhou Ren, Xiaorong Pu, Lifang He</p>
</div>
</article>
<article class="pub">
<div class="venue">ACM MM<br><span>2024</span></div>
<div class="pub-body">
<h3>Dual-Optimized Adaptive Graph Reconstruction for Multi-View Graph Clustering</h3>
<p class="authors">Zichen Wen, Tianyi Wu, Yazhou Ren, Yawen Ling, <b>Chenhang Cui</b>, Xiaorong Pu, Lifang He</p>
</div>
</article>
</section>
<section id="experience" class="section">
<h2><span class="hash">#</span> Research Experience</h2>
<div class="timeline">
<div class="tl-item">
<div class="tl-dot"></div>
<div class="tl-content">
<h3>PhD · Latent Knowledge & Agents</h3>
<p class="muted">NExT++ Lab, NUS · Jan 2026 – Present · Advisor: Prof. Chua Tat-Seng · with Dr. Fei Shen</p>
<p>Interpretability and latent-knowledge mechanisms of large foundation models; autonomous LLM/VLM agents.</p>
</div>
</div>
<div class="tl-item">
<div class="tl-dot"></div>
<div class="tl-content">
<h3>Research Intern · Safety & Multimodal RL Alignment</h3>
<p class="muted">NExT++ Lab, NUS · Aug 2024 – Aug 2025 · Advisors: Prof. Chua Tat-Seng, Prof. Zhenkai Liang · Host: Prof. An Zhang</p>
<p>Enhancing safety and alignment of VLLMs; outputs accepted to ICLR 2025 and NeurIPS 2025.</p>
</div>
</div>
<div class="tl-item">
<div class="tl-dot"></div>
<div class="tl-content">
<h3>Research Intern · Hallucination in Large VLMs</h3>
<p class="muted">UNC MURGe-Lab · May 2023 – Jan 2024 · Host: Prof. Huaxiu Yao</p>
<p>Reduced object hallucination by 23% on MiniGPT-4 without sacrificing diversity; ICLR 2024 + NeurIPS 2023 Workshop.</p>
</div>
</div>
<div class="tl-item">
<div class="tl-dot"></div>
<div class="tl-content">
<h3>Undergraduate Research · Multi-view Representation Learning</h3>
<p class="muted">UESTC · May 2022 – Sep 2023 · Advisor: Prof. Yazhou Ren</p>
<p>Consistency & complementarity in multimodal representation; three first-author papers (NeurIPS / IJCAI / AAAI).</p>
</div>
</div>
</div>
</section>
<section class="section">
<h2><span class="hash">#</span> Honors & Services</h2>
<div class="two-col">
<div>
<h3>Honors & Awards</h3>
<ul class="plain">
<li><b>SenseTime Scholarship</b> — top 25 nationwide, 2024</li>
<li><b>HUAWEI Scholarship</b>, 2023</li>
<li><b>UESTC Academic Scholarship</b>, 2022 / 2023 / 2024</li>
<li><b>MCM</b> Honorable Mention (top 15%), Student Advisor, 2024</li>
</ul>
</div>
<div>
<h3>Reviewer Service</h3>
<ul class="plain">
<li>ICLR 2025 / 2026, CVPR 2025</li>
<li>KDD 2024, ARR 2024</li>
<li>Neural Networks (journal)</li>
</ul>
</div>
</div>
</section>
<footer id="contact" class="footer">
<h2><span class="hash">#</span> Get in touch</h2>
<p>Feel free to drop me an email if you'd like to chat about trustworthy multimodal AI, collaborations, or just say hi.</p>
<div class="cta">
<a class="btn primary" href="mailto:chenhangcui@gmail.com"><i class="fa-regular fa-envelope"></i> chenhangcui@gmail.com</a>
<a class="btn" href="https://scholar.google.com/citations?user=V5X1gdAAAAAJ&hl=en" target="_blank" rel="noopener"><i class="fa-solid fa-graduation-cap"></i> Scholar</a>
<a class="btn" href="https://github.com/chenhangcuisg-code" target="_blank" rel="noopener"><i class="fa-brands fa-github"></i> GitHub</a>
</div>
<p class="copyright">© <span id="year"></span> Chenhang Cui · Built with HTML & vibes · Hosted on GitHub Pages</p>
</footer>
<script>
document.getElementById('year').textContent = new Date().getFullYear();
// Theme toggle
const root = document.documentElement;
const tbtn = document.getElementById('theme-toggle');
const saved = localStorage.getItem('theme');
if (saved) root.dataset.theme = saved;
tbtn.addEventListener('click', () => {
const next = root.dataset.theme === 'dark' ? 'light' : 'dark';
root.dataset.theme = next;
localStorage.setItem('theme', next);
tbtn.innerHTML = next === 'dark'
? '<i class="fa-solid fa-sun"></i>'
: '<i class="fa-regular fa-moon"></i>';
});
// Animated background dots
const canvas = document.getElementById('bg-canvas');
const ctx = canvas.getContext('2d');
let w, h, particles;
function resize() {
w = canvas.width = window.innerWidth;
h = canvas.height = window.innerHeight;
particles = Array.from({length: 60}, () => ({
x: Math.random()*w, y: Math.random()*h,
vx: (Math.random()-0.5)*0.3, vy: (Math.random()-0.5)*0.3,
r: Math.random()*1.5+0.5
}));
}
window.addEventListener('resize', resize); resize();
function draw() {
ctx.clearRect(0,0,w,h);
const color = getComputedStyle(document.documentElement).getPropertyValue('--dot').trim();
particles.forEach(p => {
p.x += p.vx; p.y += p.vy;
if (p.x<0||p.x>w) p.vx*=-1;
if (p.y<0||p.y>h) p.vy*=-1;
ctx.beginPath();
ctx.arc(p.x, p.y, p.r, 0, Math.PI*2);
ctx.fillStyle = color;
ctx.fill();
});
for (let i=0;i<particles.length;i++) {
for (let j=i+1;j<particles.length;j++) {
const dx = particles[i].x-particles[j].x;
const dy = particles[i].y-particles[j].y;
const d = Math.hypot(dx,dy);
if (d<120) {
ctx.beginPath();
ctx.moveTo(particles[i].x, particles[i].y);
ctx.lineTo(particles[j].x, particles[j].y);
ctx.strokeStyle = color;
ctx.globalAlpha = 1 - d/120;
ctx.stroke();
ctx.globalAlpha = 1;
}
}
}
requestAnimationFrame(draw);
}
draw();
</script>
</body>
</html>