Skip to content

Commit 2614e07

Browse files
committed
Add poem overlay functionality and styles for enhanced user experience
- Introduced a new poem overlay feature in secrets.js that displays random personal poems when a cell is enlarged. - Added corresponding CSS styles in secrets.css for the poem overlay, including responsive design adjustments. - Updated writings.html to improve header link structure for better navigation.
1 parent 0294839 commit 2614e07

File tree

3 files changed

+213
-50
lines changed

3 files changed

+213
-50
lines changed

css/secrets.css

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,86 @@ svg {
1818

1919
.cell:hover {
2020
transform: rotate(90deg);
21+
}
22+
23+
/* Poem overlay styles */
24+
.poem-overlay {
25+
position: fixed;
26+
top: 0;
27+
left: 0;
28+
width: 100vw;
29+
height: 100vh;
30+
background: rgba(34, 34, 34, 0.95);
31+
display: flex;
32+
align-items: center;
33+
justify-content: center;
34+
opacity: 0;
35+
transition: opacity 0.8s ease-in-out;
36+
z-index: 10000;
37+
cursor: pointer;
38+
}
39+
40+
.poem-overlay.visible {
41+
opacity: 1;
42+
}
43+
44+
.poem-container {
45+
max-width: 600px;
46+
max-height: 80vh;
47+
padding: 3rem;
48+
text-align: center;
49+
overflow-y: auto;
50+
background: rgba(34, 34, 34, 0.8);
51+
border: 1px solid #f8f8f6;
52+
}
53+
54+
.poem-title {
55+
color: #f8f8f6;
56+
font-family: "Trebuchet MS", Helvetica, sans-serif;
57+
font-size: 1.25em;
58+
margin-bottom: 2rem;
59+
font-weight: bold;
60+
letter-spacing: 2px;
61+
padding-top: 2em;
62+
}
63+
64+
.poem-text {
65+
color: #f8f8f6;
66+
font-family: 'Roboto Slab', serif;
67+
font-size: 1.25em;
68+
line-height: 1.5;
69+
margin: 1em 0;
70+
margin-bottom: 2rem;
71+
text-align: left;
72+
white-space: pre-line;
73+
}
74+
75+
.poem-close {
76+
color: #a6a9ac;
77+
font-family: 'Roboto Slab', serif;
78+
font-size: 0.9rem;
79+
font-style: italic;
80+
opacity: 0.7;
81+
animation: pulse 2s infinite;
82+
}
83+
84+
@keyframes pulse {
85+
0%, 100% { opacity: 0.7; }
86+
50% { opacity: 0.3; }
87+
}
88+
89+
/* Mobile responsive */
90+
@media (max-width: 768px) {
91+
.poem-container {
92+
max-width: 90vw;
93+
padding: 2rem;
94+
}
95+
96+
.poem-title {
97+
font-size: 1.1em;
98+
}
99+
100+
.poem-text {
101+
font-size: 1em;
102+
}
21103
}

js/secrets.js

Lines changed: 130 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,105 @@
11
var shapes;
22

3+
// Personal poems for the secret garden
4+
var personalPoems = [
5+
{
6+
title: "dear old lover",
7+
text: `I got a message from an old boyfriend, asking me to be penpals,
8+
and wishing me well. But dating him was like chasing the wind.
9+
10+
It's wild that I chased the wind. When I felt like running after
11+
something, and something felt like nothing and now nothing keeps
12+
trying to play tag.
13+
14+
I know how the wind feels.
15+
Somedays I think
16+
I'll meet you outside my window,
17+
but when I look out
18+
all I see is rain.`
19+
},
20+
{
21+
title: "tuesday night",
22+
text: `Hey I know it's late, but I think I left some of my stuff at your place.
23+
I think the back of my neck maybe somewhere near your ps3. Or maybe
24+
by your bong.
25+
I think I may have left my favorite pair of socks and the
26+
small of my back. I mean what really matters is that black dress,
27+
I kinda need it this weekend
28+
Oh, and also that point when it hurt and I fought back tears.
29+
I can wait until the weekend, but if you're home and still up,
30+
could I pop in and grab my stuff?`
31+
},
32+
{
33+
title: "bumps",
34+
text: `bumps left. bumps right. big hands
35+
36+
no consent. bumps. brush. coast. wrap. lope. rope.
37+
38+
no words. no exchange. just bumps and bumps
39+
40+
gropes and grabs
41+
42+
unwrapping my presents, tearing paper`
43+
},
44+
{
45+
title: "young drivers",
46+
text: `constantly thinking. chaotic.
47+
i'm constantly thinking. neurotic.
48+
accelerate. foot's on the gas.
49+
ready to brake. turn. check the mirror.
50+
fifteen seconds ahead. flip a switch. switch a lane
51+
turn. slow down. angle & timing. distance & angle.
52+
turn the wheel slowly. gradual. smooth. controlled.
53+
54+
what does he think. time ticks. ticks of the signal.
55+
silence.
56+
speak. check mirrors.
57+
fifteen seconds ahead of us.
58+
fifteen miles of decisions in the rear view of
59+
my psyche.`
60+
},
61+
{
62+
title: "Untitled Poem #4",
63+
text: `There is a glass that separates me from you.
64+
I can't tell if its visable, if its clear or opaque
65+
66+
There is a glass that separates me from you.
67+
I think you can see it. I think you know its there.
68+
Stares. staring at me.
69+
Or are they staring at the glass.
70+
71+
If they looked away, did they look away from the divide.
72+
Did they look away from me.
73+
74+
There's a glass that separates me from you.
75+
Its stiff. Its thick. Its Cold. Like classroom lighting.
76+
Its enclosing. Its plastic wrap. And I
77+
don't have enough air to breathe.`
78+
},
79+
{
80+
title: "sensitivity",
81+
text: `a blessing and a curse
82+
imagine too much sensitivity
83+
couldn't swallow a bite because
84+
i could feel it too much in my throat.
85+
place your hand on my shoulder
86+
slap.
87+
a rush of electricity upon contact.
88+
89+
like a fox on the highway, dodging
90+
judgement, anxiety, social disturbance
91+
speak. check mirrors.
92+
ten over the speed limit.
93+
94+
wildfire kisses.
95+
eye contact like splinters.
96+
but he can't hide a smirk.`
97+
}
98+
];
99+
100+
function getRandomPoem() {
101+
return personalPoems[Math.floor(Math.random() * personalPoems.length)];
102+
}
3103

4104
window.addEventListener('load', () => {
5105
if (document.readyState === "complete") {
@@ -123,58 +223,39 @@ function toggleSVG(cell, two, shape) {
123223
var isEnlarged = cell.data("isEnlarged");
124224

125225
if (isEnlarged) {
126-
// Shrink back to original size
127-
cell.css({
128-
position: "absolute",
129-
width: two.width,
130-
height: two.height,
131-
zIndex: 1
132-
});
133-
134-
shape.translation.set(two.width / 2, two.height / 2);
135-
shape.scale = 1;
136-
// Remove text if it exists
137-
var text = shape.children.find(child => child instanceof Two.Text);
138-
if (text) {
139-
shape.remove(text);
140-
}
141-
two.update();
226+
// Remove poem overlay and return to normal
227+
$('.poem-overlay').remove();
228+
$('.cell').data("isEnlarged", false);
142229
} else {
143-
// Enlarge to cover the entire screen
144-
var newWidth = $(window).width();
145-
var newHeight = $(window).height();
146-
var newCenterX = newWidth / 2;
147-
var newCenterY = newHeight / 2;
148-
var scaleFactor = Math.max(newWidth / two.width, newHeight / two.height);
149-
150-
cell.css({
151-
position: "fixed",
152-
top: 0,
153-
left: 0,
154-
width: "100vw",
155-
height: "100vh",
156-
zIndex: 9999,
157-
transition: "width 1s, height 1s"
158-
});
159-
160-
two.width = newWidth;
161-
two.height = newHeight;
162-
two.update();
163-
230+
// Show poem overlay without complex animations
231+
var poem = getRandomPoem();
232+
var poemOverlay = $(`
233+
<div class="poem-overlay">
234+
<div class="poem-container">
235+
<h3 class="poem-title">${poem.title}</h3>
236+
<div class="poem-text">${poem.text.replace(/\n/g, '<br>')}</div>
237+
<div class="poem-close">click anywhere to close</div>
238+
</div>
239+
</div>
240+
`);
164241

165-
166-
two.bind("update", function() {
167-
shape.scale += (scaleFactor - shape.scale) * 0.1;
168-
shape.translation.set(newCenterX, newCenterY);
169-
170-
if (Math.abs(shape.scale - scaleFactor) < 0.01) {
171-
shape.scale = scaleFactor;
172-
two.unbind("update");
173-
}
242+
$('body').append(poemOverlay);
243+
244+
// Add click handler to close overlay with fade out animation
245+
poemOverlay.on('click', function() {
246+
var overlay = $(this);
247+
overlay.removeClass('visible');
248+
setTimeout(() => {
249+
overlay.remove();
250+
$('.cell').data("isEnlarged", false);
251+
}, 800); // Wait for fade out animation to complete
174252
});
253+
254+
// Fade in the poem
255+
setTimeout(() => {
256+
poemOverlay.addClass('visible');
257+
}, 100);
175258

176-
two.play();
259+
$('.cell').data("isEnlarged", true);
177260
}
178-
179-
cell.data("isEnlarged", !isEnlarged);
180261
}

writings.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<section class="writing">
4141
<div class="top-bar">
4242
<h1 class="header">
43-
<a href="./secrets.html"><img class="header-img" src="assets/images/flower.svg"></a>
43+
<a href="./secrets.html" class="simple-link"><img class="header-img" src="assets/images/flower.svg"></a>
4444
writing
4545
</h1>
4646
</div>

0 commit comments

Comments
 (0)