Skip to content

Commit c8661b2

Browse files
committed
feat: Added incremental text generation to ChatGPT response
1 parent a6caa52 commit c8661b2

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

public/static/js/SplitText.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/tech_fair/2025/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<script defer src="main.js"></script>
99
<link rel="icon" type="image/png" href="/static/icons/favicon_colourful.svg" />
1010
<script defer src="/static/js/gsap.min.js"></script>
11+
<script defer src="/static/js/SplitText.min.js"></script>
1112
<script defer src="/static/js/ScrollTrigger.min.js"></script>
1213
<!-- ScrollSmoother requires ScrollTrigger -->
1314
<script defer src="/static/js/ScrollSmoother.min.js"></script>
@@ -94,7 +95,7 @@ <h2>What is Tech Fair?</h2>
9495
</div>
9596
<div class="chat-section">
9697
<h2 class="chat section-content right">ChatGPT, summarize this section</h2>
97-
<div class="chat section-content left">
98+
<div class="chat section-content response left">
9899
<ul>
99100
<li>
100101
When: <strong>Wednesday, October 15, 2025</strong> from

public/tech_fair/2025/main.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,28 @@ function setScrolledEffect() {
7070
});
7171
}
7272

73+
function setIncrementalText() {
74+
let split = SplitText.create('.response', {
75+
type: 'words'
76+
});
77+
78+
gsap.from(split.words, {
79+
scrollTrigger: {
80+
trigger: '.response',
81+
start: 'top bottom',
82+
once: true
83+
},
84+
autoAlpha: 0,
85+
stagger: 0.05
86+
});
87+
}
88+
7389
document.addEventListener('DOMContentLoaded', () => {
74-
gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
90+
gsap.registerPlugin(ScrollTrigger, SplitText, ScrollSmoother);
7591
photos = document.querySelectorAll('.gallery-content');
7692
document.body.style.display = 'block';
7793

7894
setPopInEffect();
7995
setScrolledEffect();
96+
setIncrementalText();
8097
});

0 commit comments

Comments
 (0)