Skip to content

Commit 312bbe6

Browse files
committed
.
1 parent 00676cc commit 312bbe6

File tree

7 files changed

+649
-0
lines changed

7 files changed

+649
-0
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.

public/kaidata/index.html

Lines changed: 262 additions & 0 deletions
Large diffs are not rendered by default.

public/kaidata/scripts.js

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// Progress bar
2+
window.addEventListener('scroll', () => {
3+
const winScroll = document.body.scrollTop || document.documentElement.scrollTop;
4+
const height = document.documentElement.scrollHeight - document.documentElement.clientHeight;
5+
const scrolled = (winScroll / height) * 100;
6+
document.getElementById('progressBar').style.width = scrolled + '%';
7+
});
8+
9+
// Reveal on scroll
10+
const reveals = document.querySelectorAll('.reveal');
11+
const revealObserver = new IntersectionObserver((entries) => {
12+
entries.forEach(entry => {
13+
if (entry.isIntersecting) entry.target.classList.add('visible');
14+
});
15+
}, { threshold: 0.1 });
16+
reveals.forEach(el => revealObserver.observe(el));
17+
18+
// Counter animation
19+
const counters = document.querySelectorAll('.counter');
20+
const counterObserver = new IntersectionObserver((entries) => {
21+
entries.forEach(entry => {
22+
if (entry.isIntersecting) {
23+
const counter = entry.target;
24+
const target = parseInt(counter.getAttribute('data-target'));
25+
let current = 0;
26+
const increment = target / 50;
27+
const updateCounter = () => {
28+
if (current < target) {
29+
current += increment;
30+
counter.textContent = Math.ceil(current);
31+
requestAnimationFrame(updateCounter);
32+
} else {
33+
counter.textContent = target;
34+
}
35+
};
36+
updateCounter();
37+
counterObserver.unobserve(counter);
38+
}
39+
});
40+
}, { threshold: 0.5 });
41+
counters.forEach(counter => counterObserver.observe(counter));
42+
43+
// Deploy tabs
44+
const deployTabs = document.querySelectorAll('.deploy-tab');
45+
const deployContents = document.querySelectorAll('.deploy-content');
46+
deployTabs.forEach(tab => {
47+
tab.addEventListener('click', () => {
48+
deployTabs.forEach(t => t.classList.remove('active'));
49+
deployContents.forEach(c => c.classList.remove('active'));
50+
tab.classList.add('active');
51+
document.getElementById(tab.dataset.tab).classList.add('active');
52+
});
53+
});
54+
55+
// Copy citation
56+
function copyCitation() {
57+
const citation = document.querySelector('.citation-code').textContent;
58+
navigator.clipboard.writeText(citation);
59+
const btn = document.querySelector('.citation-copy');
60+
btn.textContent = 'Copied!';
61+
setTimeout(() => btn.textContent = 'Copy', 2000);
62+
}
63+
64+
// Charts
65+
const chartColors = { robot: '#4A90D9', cotrain: '#00D4AA', grid: 'rgba(255,255,255,0.05)' };
66+
const chartOptions = {
67+
responsive: true,
68+
maintainAspectRatio: false,
69+
plugins: {
70+
legend: { display: false },
71+
tooltip: { backgroundColor: 'rgba(10,10,15,0.9)', titleColor: '#fff', bodyColor: '#8B8B9E', borderColor: 'rgba(255,255,255,0.1)', borderWidth: 1, padding: 12, cornerRadius: 8 }
72+
},
73+
scales: {
74+
x: { grid: { color: chartColors.grid }, ticks: { color: '#8B8B9E' } },
75+
y: { grid: { color: chartColors.grid }, ticks: { color: '#8B8B9E' }, min: 0, max: 100 }
76+
}
77+
};
78+
79+
const inDomainCtx = document.getElementById('inDomainChart');
80+
if (inDomainCtx) {
81+
new Chart(inDomainCtx, {
82+
type: 'bar',
83+
data: {
84+
labels: ['Pillow', 'Trash', 'Toy', 'Cart', 'Average'],
85+
datasets: [
86+
{ label: 'Robot-only', data: [60, 61.3, 47.5, 42.5, 58.8], backgroundColor: chartColors.robot, borderRadius: 6 },
87+
{ label: 'Co-training', data: [85, 97.5, 70, 42.5, 78.4], backgroundColor: chartColors.cotrain, borderRadius: 6 }
88+
]
89+
},
90+
options: chartOptions
91+
});
92+
}
93+
94+
const genCtx = document.getElementById('generalizationChart');
95+
if (genCtx) {
96+
new Chart(genCtx, {
97+
type: 'bar',
98+
data: {
99+
labels: ['Pillow', 'Trash', 'Toy', 'Cart', 'Average'],
100+
datasets: [
101+
{ label: 'Robot-only', data: [0, 55, 37.5, 31.3, 30.9], backgroundColor: chartColors.robot, borderRadius: 6 },
102+
{ label: 'Co-training', data: [97.5, 87.5, 78.8, 65, 82.2], backgroundColor: chartColors.cotrain, borderRadius: 6 }
103+
]
104+
},
105+
options: chartOptions
106+
});
107+
}
108+
109+
// Smooth scroll
110+
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
111+
anchor.addEventListener('click', function(e) {
112+
e.preventDefault();
113+
const target = document.querySelector(this.getAttribute('href'));
114+
if (target) target.scrollIntoView({ behavior: 'smooth', block: 'start' });
115+
});
116+
});
117+
118+
// Nav background
119+
const nav = document.querySelector('.nav');
120+
window.addEventListener('scroll', () => {
121+
nav.style.background = window.scrollY > 50 ? 'rgba(10, 10, 15, 0.95)' : 'rgba(10, 10, 15, 0.85)';
122+
});

0 commit comments

Comments
 (0)