Skip to content

Commit fd6b566

Browse files
author
Oussama
committed
fix: incorporate final peer feedback
1 parent 5c73cae commit fd6b566

10 files changed

Lines changed: 336 additions & 152 deletions

File tree

website/src/lib/charts/Treemap.svelte

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,27 @@
7474
y2: leaf.y1 - pad,
7575
}));
7676
}
77+
78+
function pictureType(medium = '') {
79+
if (medium.includes('Photography')) return 'photo';
80+
if (medium.includes('Architecture') || medium.includes('Design')) return 'design';
81+
if (medium.includes('Painting') || medium.includes('Sculpture')) return 'painting';
82+
if (medium.includes('Film') || medium.includes('Media')) return 'film';
83+
return 'paper';
84+
}
85+
86+
function pictureBox(leaf) {
87+
const w = leaf.x1 - leaf.x0;
88+
const h = leaf.y1 - leaf.y0;
89+
if (w < 58 || h < 46) return null;
90+
const size = Math.min(w * 0.42, h * 0.48, 130);
91+
return {
92+
x: leaf.x1 - size - Math.max(10, w * 0.06),
93+
y: leaf.y1 - size * 0.72 - Math.max(10, h * 0.06),
94+
w: size,
95+
h: size * 0.72,
96+
};
97+
}
7798
</script>
7899
79100
<figure class="treemap" aria-label="Treemap of MoMA collection areas by number of works">
@@ -89,6 +110,7 @@
89110
{@const leafWidth = leaf.x1 - leaf.x0}
90111
{@const leafHeight = leaf.y1 - leaf.y0}
91112
{@const area = leafWidth * leafHeight}
113+
{@const box = pictureBox(leaf)}
92114
<g class="leaf" style:--rank={leaf.rank}>
93115
<rect
94116
class="mark"
@@ -122,6 +144,21 @@
122144
<line x1={line.x1} y1={line.y1} x2={line.x2} y2={line.y2} />
123145
{/each}
124146
</g>
147+
{#if box}
148+
<g class={`picture ${pictureType(leaf.data.medium)}`} clip-path={`url(#leaf-clip-${leaf.rank})`}>
149+
<rect x={box.x} y={box.y} width={box.w} height={box.h} />
150+
<path
151+
d={`M ${box.x + box.w * 0.12} ${box.y + box.h * 0.72} C ${box.x + box.w * 0.34} ${box.y + box.h * 0.28}, ${box.x + box.w * 0.52} ${box.y + box.h * 0.76}, ${box.x + box.w * 0.88} ${box.y + box.h * 0.26}`}
152+
/>
153+
<circle cx={box.x + box.w * 0.72} cy={box.y + box.h * 0.34} r={Math.max(3, box.w * 0.08)} />
154+
<line
155+
x1={box.x + box.w * 0.16}
156+
x2={box.x + box.w * 0.86}
157+
y1={box.y + box.h * 0.84}
158+
y2={box.y + box.h * 0.84}
159+
/>
160+
</g>
161+
{/if}
125162
{#if area >= labelArea}
126163
<text x={leaf.x0 + 10} y={leaf.y0 + 24}>
127164
<tspan>{leaf.data.medium}</tspan>

website/src/lib/charts/treemap.css

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
}
4141

4242
.treemap .inner-frame,
43-
.treemap .motif {
43+
.treemap .motif,
44+
.treemap .picture {
4445
pointer-events: none;
4546
}
4647

@@ -56,8 +57,47 @@
5657
stroke-linecap: round;
5758
}
5859

60+
.treemap .picture {
61+
opacity: 0.56;
62+
}
63+
64+
.treemap .picture rect {
65+
fill: color-mix(in srgb, var(--bg-paper) 24%, transparent);
66+
stroke: color-mix(in srgb, var(--fg-on-light-strong) 28%, transparent);
67+
stroke-width: 1.4;
68+
}
69+
70+
.treemap .picture path,
71+
.treemap .picture line {
72+
fill: none;
73+
stroke: color-mix(in srgb, var(--fg-on-light-strong) 38%, transparent);
74+
stroke-width: 2;
75+
stroke-linecap: round;
76+
}
77+
78+
.treemap .picture circle {
79+
fill: color-mix(in srgb, var(--accent-primary) 32%, transparent);
80+
stroke: color-mix(in srgb, var(--fg-on-light-strong) 24%, transparent);
81+
stroke-width: 1.2;
82+
}
83+
84+
.treemap .picture.photo circle {
85+
fill: color-mix(in srgb, var(--region-namerica) 32%, transparent);
86+
}
87+
88+
.treemap .picture.design circle {
89+
fill: color-mix(in srgb, var(--region-europe) 30%, transparent);
90+
}
91+
92+
.treemap .picture.film circle {
93+
fill: color-mix(in srgb, var(--region-africa) 30%, transparent);
94+
}
95+
5996
.treemap .leaf:has(.mark.highlight) .motif line,
60-
.treemap .leaf:has(.mark.highlight) .inner-frame {
97+
.treemap .leaf:has(.mark.highlight) .inner-frame,
98+
.treemap .leaf:has(.mark.highlight) .picture rect,
99+
.treemap .leaf:has(.mark.highlight) .picture path,
100+
.treemap .leaf:has(.mark.highlight) .picture line {
61101
stroke: color-mix(in srgb, var(--fg-on-dark-strong) 42%, transparent);
62102
}
63103

Lines changed: 5 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { onDestroy, onMount } from 'svelte';
3+
import './scene0Hero.css';
34
45
export let summary;
56
@@ -108,6 +109,10 @@
108109
<canvas bind:this={canvas} aria-hidden="true"></canvas>
109110
<p class="mark">DArts</p>
110111
<div class="hero-copy" aria-live="polite">
112+
<p class="line intro">
113+
MoMA is New York's Museum of Modern Art. Its public collection dataset records artists, dates, departments,
114+
mediums, and nationalities for the works it holds.
115+
</p>
111116
<p class="line l1"><span class="num">{summary.n_artworks_total.toLocaleString()}</span> works.</p>
112117
<p class="line l2"><span class="num">{summary.n_artists_total.toLocaleString()}</span> artists.</p>
113118
<p class="line l3">One question:</p>
@@ -118,130 +123,3 @@
118123
<span class="caret"></span>
119124
</div>
120125
</section>
121-
122-
<style>
123-
.hero-scene {
124-
position: relative;
125-
min-height: 100vh;
126-
min-height: 100svh;
127-
overflow: hidden;
128-
display: grid;
129-
place-items: center;
130-
color: var(--fg-on-dark-strong);
131-
background: var(--bg-dark);
132-
}
133-
134-
canvas {
135-
position: absolute;
136-
inset: 0;
137-
width: 100%;
138-
height: 100%;
139-
}
140-
141-
.mark {
142-
position: absolute;
143-
top: var(--space-4);
144-
left: var(--space-4);
145-
margin: 0;
146-
color: var(--fg-on-dark-strong);
147-
font-family: var(--font-display);
148-
font-size: var(--type-h3-size);
149-
font-weight: 600;
150-
}
151-
152-
.hero-copy {
153-
position: relative;
154-
z-index: 1;
155-
width: min(58rem, calc(100vw - var(--space-4)));
156-
text-align: center;
157-
}
158-
159-
.line {
160-
margin: 0;
161-
opacity: 0;
162-
translate: 0 0.75rem;
163-
animation: hero-line 900ms var(--ease-out) forwards;
164-
}
165-
166-
.l1,
167-
.l2,
168-
.l3 {
169-
color: var(--fg-on-dark-mute);
170-
font-family: var(--font-ui);
171-
font-size: clamp(1.25rem, 4vw, var(--type-h2-size));
172-
font-weight: 600;
173-
line-height: var(--type-h2-line);
174-
}
175-
176-
.l2 {
177-
animation-delay: 650ms;
178-
}
179-
180-
.l3 {
181-
animation-delay: 1300ms;
182-
}
183-
184-
.l4 {
185-
margin-top: var(--space-2);
186-
color: var(--fg-on-dark-strong);
187-
font-family: var(--font-display);
188-
font-size: clamp(2.75rem, 9vw, var(--type-display-size));
189-
font-weight: 600;
190-
line-height: var(--type-display-line);
191-
animation-delay: 2100ms;
192-
}
193-
194-
.num {
195-
color: var(--seq-1);
196-
font-family: var(--font-mono);
197-
font-variant-numeric: tabular-nums;
198-
}
199-
200-
.scroll-cue {
201-
position: absolute;
202-
bottom: var(--space-4);
203-
left: 50%;
204-
z-index: 1;
205-
display: grid;
206-
gap: var(--space-1);
207-
justify-items: center;
208-
color: var(--fg-on-dark-mute);
209-
font-family: var(--font-ui);
210-
font-size: var(--type-small-size);
211-
translate: -50% 0;
212-
animation: cue-bob 1600ms var(--ease-inout) infinite;
213-
}
214-
215-
.caret {
216-
width: 0.625rem;
217-
height: 0.625rem;
218-
border-right: 1px solid currentColor;
219-
border-bottom: 1px solid currentColor;
220-
rotate: 45deg;
221-
}
222-
223-
@keyframes hero-line {
224-
to {
225-
opacity: 1;
226-
translate: 0 0;
227-
}
228-
}
229-
230-
@keyframes cue-bob {
231-
50% {
232-
translate: -50% 0.375rem;
233-
}
234-
}
235-
236-
@media (prefers-reduced-motion: reduce) {
237-
.line {
238-
opacity: 1;
239-
translate: 0 0;
240-
animation: none;
241-
}
242-
243-
.scroll-cue {
244-
animation: none;
245-
}
246-
}
247-
</style>

website/src/lib/scenes/Scene2Globe.svelte

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
let { countryByDecade = [], countrySummary = [], timeline = [] } = $props();
1212
1313
const topThree = new Set(['USA', 'FRA', 'DEU']);
14+
const topThreeLegend = [{ label: 'United States, France, Germany', color: 'var(--accent-primary)' }];
1415
1516
let active = $derived($filters.activeScene === 2);
1617
let step = $derived(active ? $filters.activeStep : 0);
@@ -61,6 +62,29 @@
6162
subline="Country color uses a sequential luminance ramp on credited works. The red-orange exception marks the top three."
6263
dark
6364
/>
65+
<p class="interaction-hint">
66+
Drag anywhere on the globe. Click a country to open an artist suggestion from its records.
67+
</p>
68+
{#if step >= 1}
69+
<div class="legend-stack">
70+
<Legend
71+
mode="sequential"
72+
minLabel="< 10"
73+
midLabel="100"
74+
maxLabel=">= 1,000"
75+
caption="Light-to-dark land color encodes credited works in the active decade range."
76+
dark
77+
/>
78+
{#if step >= 2}
79+
<Legend
80+
mode="categorical"
81+
items={topThreeLegend}
82+
caption="Orange marks the three-country dominance claim."
83+
dark
84+
/>
85+
{/if}
86+
</div>
87+
{/if}
6488
<div class="steps">
6589
<ScrollStep scene={2} step={0}
6690
><p>Artists from <strong>129</strong> recorded nationalities enter the collection.</p></ScrollStep
@@ -78,18 +102,7 @@
78102
><p>Scrub time: the concentration bends, but it does not disappear.</p></ScrollStep
79103
>
80104
</div>
81-
<Legend
82-
mode="sequential"
83-
minLabel="< 10"
84-
midLabel="100"
85-
maxLabel=">= 1,000"
86-
caption="Color encodes credited works in the active decade range."
87-
dark
88-
/>
89105
<p class="exclusion">Excluded: 2.3% of artist credits have no mapped nationality in the cleaned corpus.</p>
90-
<p class="interaction-hint">
91-
Drag anywhere on the globe. Click a country to open an artist suggestion from its records.
92-
</p>
93106
{#if step >= 3}
94107
<div class="slider-panel">
95108
<DecadeSlider {timeline} ariaLabel="Filter globe by decade range" dark />

website/src/lib/scenes/Scene3Gender.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<div class="sticky-chart">
8383
<SceneTitle
8484
kicker="Scene 3"
85-
title="Parity took a century."
85+
title="Gender parity took a century."
8686
subline="The y-axis is fixed at 0-60% so changes remain comparable across filters and departments."
8787
/>
8888
<div class="controls">

0 commit comments

Comments
 (0)