Repository navigation
Expand file tree
/
Copy pathwriteup-loader.js
More file actions
126 lines (112 loc) · 5.87 KB
/
Copy pathwriteup-loader.js
File metadata and controls
126 lines (112 loc) · 5.87 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
document.addEventListener('DOMContentLoaded', function() {
const writeupContainer = document.getElementById('writeup-content-container');
// Function to create the writeup content
function createWriteup(data) {
// Clear loading indicator
writeupContainer.innerHTML = '';
// Create summary section
const summarySection = document.createElement('div');
summarySection.className = 'project-summary';
summarySection.innerHTML = `
<p class="writeup-paragraph">An interactive visualization of EEG data, making brain activity more tangible and intuitive through animated 3D representations and multi-channel analysis.</p>
<div class="tag-container">
<span class="writeup-tag">EEG Data</span>
<span class="writeup-tag">3D Visualization</span>
<span class="writeup-tag">Interactive</span>
<span class="writeup-tag">D3.js</span>
<span class="writeup-tag">Three.js</span>
</div>
`;
writeupContainer.appendChild(summarySection);
// Process each section
data.sections.forEach((section, index) => {
const sectionDiv = document.createElement('div');
sectionDiv.className = 'writeup-section';
// Add heading
const heading = document.createElement('h3');
heading.className = 'writeup-heading';
heading.textContent = section.heading;
sectionDiv.appendChild(heading);
// Add paragraphs
section.paragraphs.forEach((paragraph, paragraphIndex) => {
// Check if this is the last paragraph in Development Process for highlight box
const isHighlight = section.heading === "Development Process" &&
paragraphIndex === section.paragraphs.length - 1;
if (isHighlight) {
const highlightBox = document.createElement('div');
highlightBox.className = 'highlight-box';
const para = document.createElement('p');
para.className = 'writeup-paragraph';
para.textContent = paragraph;
highlightBox.appendChild(para);
sectionDiv.appendChild(highlightBox);
} else {
const para = document.createElement('p');
para.className = 'writeup-paragraph';
para.textContent = paragraph;
sectionDiv.appendChild(para);
}
});
writeupContainer.appendChild(sectionDiv);
});
}
// Attempt to fetch JSON data
fetch('writeup.json')
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
// Create the writeup with a slight delay for smoother transitions
setTimeout(() => createWriteup(data), 300);
})
.catch(error => {
console.error('Error loading writeup data:', error);
// Use static data if fetch fails (for demo/testing purposes)
const staticData = {
"title": "Project 3 Writeup",
"sections": [
{
"heading": "Motivation",
"paragraphs": [
"EEG data can feel abstract and difficult to interpret. We wanted to make brain activity more tangible and visually intuitive. By exploring the data ourselves, we noticed how understanding improved when we visualized it physically—so we designed an interface that helps users do the same, making neural patterns more accessible through interactive exploration."
]
},
{
"heading": "Design Rationale",
"paragraphs": [
"We used animated bubbles on a 3D brain to represent channel intensity—bubbles grow or jitter more when signals vary rapidly. This movement-based encoding helped communicate activity levels more intuitively than static color or size alone. Color was kept consistent across all views to preserve recognition, and we emphasized interaction: users can rotate the brain and zoom into any view. We skipped a legend for bubble size because zooming made it context-dependent.",
"In the second tab, we included a multi-line plot with confidence intervals. While complex, it supports deeper comparison across channels. We made this optional to keep the main view clean and user-friendly. Dropdown filters help narrow focus to relevant participants or channels."
]
},
{
"heading": "Development Process",
"paragraphs": [
"We started by reviewing multiple datasets and picked EEG data based on team interest. Each member contributed exploratory visualizations for the checkpoint. Afterward, we switched to a new dataset for better creative flexibility.",
"One member scaffolded the site, and tasks were split among frontend design, D3 implementation, and debugging. Each of us spent between 4-12 hours on the project. Time was mainly spent debugging interactivity and managing complex collaborative code.",
"Major challenges included: designing interactions that add clarity (not clutter), managing large data and performance in D3, and fixing subtle visual or state bugs across tabs."
]
}
]
};
// Create the writeup with static data
createWriteup(staticData);
});
// Add tab transition effect
const writeupTab = document.getElementById('project-writeup-tab');
if (writeupTab) {
writeupTab.addEventListener('click', () => {
// Add a subtle refresh animation when switching to the writeup tab
if (writeupContainer.querySelectorAll('.writeup-section').length > 0) {
writeupContainer.querySelectorAll('.writeup-section').forEach((section, i) => {
section.style.animation = 'none';
section.offsetHeight; // Trigger reflow
section.style.animation = `fadeIn 0.5s ease forwards ${0.1 + i * 0.1}s`;
section.style.opacity = '0';
});
}
});
}
});