Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/css/doors/home.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
.area-jus{--tone:var(--jus);--tint:var(--jus-bg)}
.area-com{--tone:var(--com);--tint:var(--com-bg)}
.area-plate{position:relative;height:clamp(176px,14.5vw,208px);min-height:0}
.area-plate img{position:absolute;inset:24% 11% 2%;width:78%;height:74%;max-width:none;object-fit:contain}
.area-plate img{position:absolute;inset:24% 11% 2%;width:78%;height:74%;max-width:none;object-fit:contain;object-position:50% 100%}
.area-body{display:flex;flex-direction:column;flex:1;padding-top:12px}
.area h3{font-size:clamp(26px,2.1vw,31px);line-height:1.12;color:var(--tone);min-height:2.3em;margin:0;overflow-wrap:anywhere}
.area-body>p{margin:8px 0 0;font-size:16px;line-height:1.5}
Expand Down Expand Up @@ -129,7 +129,7 @@
.areas{grid-template-columns:1fr;gap:12px;padding-top:18px}
.area{display:grid;grid-template-columns:78px minmax(0,1fr);column-gap:14px;padding:14px;border-radius:var(--r-large)}
.area-plate{height:92px;align-self:start;background:#ffffffb0;border-radius:999px 999px 0 0}
.area-plate img{inset:14px 8px 2px;width:calc(100% - 16px);height:calc(100% - 16px)}
.area-plate img{inset:20px 8px 6px;width:calc(100% - 16px);height:calc(100% - 26px)}
.area-body{display:block;padding-top:0}
.area h3{font-size:23px}
.area-body>p{margin-top:5px}
Expand Down
2 changes: 1 addition & 1 deletion assets/css/doors/welcome.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@
@media(max-width:760px){
.welcome-areas .area{grid-template-columns:minmax(0,1fr);row-gap:10px}
.welcome-areas .area-plate{width:176px;height:150px}
.welcome-areas .area-plate img{inset:20px 14px 4px;width:calc(100% - 28px);height:calc(100% - 24px)}
.welcome-areas .area-plate img{inset:30px 14px 10px;width:calc(100% - 28px);height:calc(100% - 40px)}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/doors/area-education-bricks.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/doors/area-education.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/doors/area-justice-bricks.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/doors/area-research-bricks.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/js/castle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The animated brick tower in the home page's arched door. Hugo bundles it with `j
| `castle-geometry.js` | The bricks |
| `castle-piles.js` | Baked resting poses of the two heaps. Generated, see below |
| `bake-castle-piles.js` | Offline physics bake for those poses. Never part of the site's bundle |
| `illustrations-render.js`, `illustrations-harness.html` | Offline renderer for the education, research and community area plates; `scripts/rebrand/render_area_illustrations.py` renders them. Never part of the site's bundle |
| `illustrations-render.js`, `education-render.js`, `illustrations-harness.html` | Offline renderers for the research and community area plates (`illustrations-render.js`) and the education plate (`education-render.js`); `scripts/rebrand/render_area_illustrations.py` renders them. Never part of the site's bundle |
| `../doors/castle.js` | Loads the bundle after paint and owns playback: pause, hover, tap, off-screen suspension. Also opens the tower game, see `../tower/README.md` |
| `../doors/motion.js` | The pause state the castle shares with the home page's quotes, remembered between visits |

Expand Down
169 changes: 169 additions & 0 deletions assets/js/castle/education-render.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/* The education area plate: a stack of brick books under a mortarboard (assets/images/doors/area-education.webp).
Rendered offline by scripts/rebrand/render_area_illustrations.py; never part of the site's bundle.
Unlike illustrations-render.js, it takes its lights, shadow, materials, stud profile, brick pitch and course
height from castle-scene.js and castle-geometry.js, and keeps the castle's camera scale. */
import * as T from 'three';
import { RoundedBoxGeometry } from 'three/addons/geometries/RoundedBoxGeometry.js';
import { mergeGeometries } from 'three/addons/utils/BufferGeometryUtils.js';

// ---- The castle's brick system (castle-geometry.js) ----
const PITCH = .30, COURSE = .27, PLATE = .09, GAP = .014;
const studGeometry = new T.LatheGeometry([
new T.Vector2(0, 0), new T.Vector2(.078, 0), new T.Vector2(.087, .008),
new T.Vector2(.087, .048), new T.Vector2(.080, .055), new T.Vector2(0, .055)
], 16);
const merge = parts => { const g = mergeGeometries(parts.map(p => p.index ? p.toNonIndexed() : p), false); g.computeBoundingSphere(); return g; };
const studAt = (x, y, z) => studGeometry.clone().applyMatrix4(new T.Matrix4().makeTranslation(x, y, z));
const cache = new Map();
function brickGeometry(width, height, depth, studs = true) {
const key = [width, height, depth, studs].map(v => typeof v === 'number' ? v.toFixed(4) : v).join('/');
if (cache.has(key)) return cache.get(key);
// The joint gap applies only to real bricks; thin detail strips (page lines) keep their size.
const inset = v => v > 2 * GAP ? v - GAP : v;
const parts = [new RoundedBoxGeometry(inset(width), inset(height), inset(depth), 2, Math.min(.011, Math.min(width, height, depth) / 3))];
if (studs) {
const columns = Math.max(1, Math.floor((width - .18) / PITCH) + 1);
const rows = Math.max(1, Math.floor((depth - .18) / PITCH) + 1);
for (let x = 0; x < columns; x++) for (let z = 0; z < rows; z++) {
const px = (x - (columns - 1) / 2) * PITCH, pz = (z - (rows - 1) / 2) * PITCH;
if (Math.abs(px) + .09 < width / 2 && Math.abs(pz) + .09 < depth / 2) parts.push(studAt(px, (height - GAP) / 2, pz));
}
}
const g = merge(parts); cache.set(key, g); return g;
}
function roundGeometry(radius, height, stud = true) {
const key = `round/${radius}/${height}/${stud}`;
if (cache.has(key)) return cache.get(key);
const h = height - GAP;
const parts = [new T.CylinderGeometry(radius - GAP / 2, radius - GAP / 2, h, 32, 1)];
if (stud) parts.push(studAt(0, h / 2, 0));
const g = merge(parts); cache.set(key, g); return g;
}

// ---- Colours: the castle's stone and brick, the Pride bands, and a few neutrals ----
const families = {
stone: ['#55616a', '#5c6870', '#637078', '#505c65', '#6b757b', '#5a666e', '#626b71'],
archStone: ['#79848a', '#707c83', '#65717a'],
dark: ['#444f58', '#3d4850', '#48535c'],
brick: ['#a84f39', '#b66147', '#9d4535', '#c17354', '#a95b44', '#bb5940', '#99503f'],
purple: ['#7046a3', '#6a42a0', '#7a4fac'],
blue: ['#2672b8', '#2a6fb2', '#2f79bd'],
green: ['#2b985b', '#2a9156', '#31a061'],
yellow: ['#edc438', '#e9bd33', '#f0ca45'],
orange: ['#e98434', '#e47e2e', '#ec8b3d'],
red: ['#ce4742', '#c8433f', '#d44f48'],
cream: ['#f1ece0', '#ece6d8', '#f4f0e6'],
ink: ['#9aa3a8'],
wood: ['#b77a45', '#ad723f', '#bf8250'],
glass: ['#cfe8f5'],
bark: ['#7a4a2a', '#86522f', '#6f4325'],
leaf: ['#3aa86a', '#41b071'],
leafDark: ['#1f8650', '#23804c']
};
const materialCache = new Map();
function mat(color) {
if (!materialCache.has(color)) materialCache.set(color, new T.MeshStandardMaterial({ color, roughness: .42, metalness: .025 }));
return materialCache.get(color);
}
let serial = 1;
// Like the castle's stones: neighbouring bricks of one colour differ slightly.
const shade = family => { const list = families[family] || [family]; return mat(list[(serial++ * 17) % list.length]); };

function place(parent, geometry, material, x, y, z, rotY = 0) {
const m = new T.Mesh(geometry, material);
m.position.set(x, y, z); m.rotation.y = rotY; m.castShadow = true; m.receiveShadow = true;
parent.add(m); return m;
}
/** A brick nx by nz studs, h high, its lower face at y. */
function brick(parent, nx, nz, color, x, y, z, { h = COURSE, rot = 0, studs = true } = {}) {
return place(parent, brickGeometry(nx * PITCH, h, nz * PITCH, studs), shade(color), x, y + h / 2, z, rot);
}
/** A box of any size in world units (for tiles, cords and the like), lower face at y. */
function slab(parent, w, h, d, color, x, y, z, { rot = 0, studs = false } = {}) {
return place(parent, brickGeometry(w, h, d, studs), shade(color), x, y + h / 2, z, rot);
}
function round(parent, radius, h, color, x, y, z, stud = true) {
return place(parent, roundGeometry(radius, h, stud), typeof color === 'string' && color.startsWith('#') ? mat(color) : shade(color), x, y + h / 2, z);
}
function group(parent, x = 0, y = 0, z = 0, rotY = 0) {
const g = new T.Group(); g.position.set(x, y, z); g.rotation.y = rotY; parent.add(g); return g;
}

// ---- Scene: castle-scene.js lighting and shadow ----
const canvas = document.querySelector('canvas');
const renderer = new T.WebGLRenderer({ canvas, alpha: true, antialias: true, preserveDrawingBuffer: true });
renderer.setPixelRatio(2);
renderer.setSize(1200, 800);
renderer.outputColorSpace = T.SRGBColorSpace;
renderer.toneMapping = T.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.05;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = T.PCFSoftShadowMap;
const scene = new T.Scene();
scene.add(new T.HemisphereLight(0xffffff, 0x8b8379, 1.75));
const key = new T.DirectionalLight(0xfffbf6, 3.5);
key.position.set(-3, 11, 6); key.castShadow = true; key.shadow.mapSize.set(2048, 2048);
Object.assign(key.shadow.camera, { left: -6, right: 6, top: 7, bottom: -5, near: .5, far: 22 });
key.shadow.normalBias = .012; key.shadow.bias = -.00008; key.shadow.radius = 3;
scene.add(key);
const fill = new T.DirectionalLight(0xf3f7ff, 1.25); fill.position.set(6, 4, -2); scene.add(fill);
const rim = new T.DirectionalLight(0xffffff, 1.2); rim.position.set(-3, 5, -5); scene.add(rim);
const ground = new T.Mesh(new T.PlaneGeometry(30, 30), new T.ShadowMaterial({ opacity: .18 }));
ground.rotation.x = -Math.PI / 2; ground.position.y = -.035; ground.receiveShadow = true; scene.add(ground);
const model = new T.Group(); scene.add(model);
const VIEW = new T.Vector3(7.4, 6.4, 10.2);

// ======================================================================
// Education
// ======================================================================

/** One closed book lying flat: covers, a page block and a spine. Spine on local -z or +z. */
function closedBook(parent, nx, nz, cover, y, x, z, rot, spineFront) {
const g = group(parent, x, y, z, rot);
const w = nx * PITCH, d = nz * PITCH, s = spineFront ? 1 : -1;
// Covers in two halves, so the joint shows like the castle's bonded courses.
const half = Math.ceil(nx / 2);
for (const [n, off] of [[half, -(nx - half) * PITCH / 2], [nx - half, half * PITCH / 2]]) {
slab(g, n * PITCH, PLATE, d, cover, off, 0, 0);
slab(g, n * PITCH, PLATE, d, cover, off, PLATE + COURSE, 0, { studs: true });
}
// The page block is set back from the three open edges.
slab(g, w - .12, COURSE, d - .1, 'cream', -.0, PLATE, -s * .04);
// Spine: one brick face along the bound edge.
slab(g, w, COURSE, .1, cover, 0, PLATE, s * (d / 2 - .05));
// Leaf lines on the fore-edge and the head, read as pages.
for (let k = 1; k < 3; k++) {
slab(g, w - .16, .006, .006, 'ink', 0, PLATE + k * COURSE / 3, -s * (d / 2 - .095));
slab(g, .006, .006, d - .16, 'ink', w / 2 - .065, PLATE + k * COURSE / 3, -s * .04);
}
return PLATE * 2 + COURSE;
}

function eduStack() {
// A tall stack of books, crowned with a mortarboard: teaching materials, gathered and shared.
const books = [[11, 8, 'green', .04, true], [10, 7, 'blue', -.08, false], [10, 8, 'brick', .09, true], [9, 7, 'yellow', -.05, false], [10, 7, 'purple', .06, true], [9, 7, 'green', -.1, false], [8, 6, 'orange', .05, true]];
let y = 0;
books.forEach(([nx, nz, c, r, front], i) => { y += closedBook(model, nx, nz, c, y, i % 2 ? .06 : -.05, i % 2 ? -.05 : .05, r, front); });
// Mortarboard: a studded skull cap and a square board set diagonally, with its tassel.
const cap = group(model, 0, y, 0, .1);
brick(cap, 4, 4, 'dark', 0, 0, 0);
const board = group(cap, 0, COURSE, 0, Math.PI / 4);
for (const off of [-.45, .45]) slab(board, 3 * PITCH, PLATE, 6 * PITCH, 'dark', off, 0, 0, { studs: true });
round(board, .11, PLATE, 'yellow', 0, PLATE, 0, true);
const cord = group(board, 0, PLATE + .05, 0, -Math.PI / 4);
const reach = 6 * PITCH / 2 * Math.SQRT2 - .1;
slab(cord, reach, .035, .05, 'yellow', reach / 2, 0, 0);
slab(cord, .05, .5, .05, 'yellow', reach + .02, -.48, 0);
round(cord, .08, .2, 'yellow', reach + .02, -.68, 0, false);
}

// ---- Render ----
const kind = 'stack';
eduStack();
const bounds = new T.Box3().setFromObject(model);
const center = bounds.getCenter(new T.Vector3());
// Fixed scale: the castle's camera on a 1200x800 canvas (halfHeight 3.25, aspect 1.5).
const camera = new T.OrthographicCamera(-4.875, 4.875, 3.25, -3.25, .1, 40);
camera.position.copy(center).add(VIEW); camera.lookAt(center); camera.updateMatrixWorld();
renderer.render(scene, camera);
window.renderReady = { kind, bounds: bounds.getSize(new T.Vector3()).toArray() };
4 changes: 3 additions & 1 deletion assets/js/castle/illustrations-harness.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
<html lang="en"><meta charset="utf-8"><title>FORRT area plates</title>
<style>html,body{margin:0;background:transparent}canvas{display:block}</style>
<script type="importmap">{"imports":{"three":"/three/index.js","three/addons/":"/three/addons/"}}</script>
<canvas></canvas><script type="module" src="illustrations-render.js"></script></html>
<canvas></canvas>
<!-- ?renderer= picks the renderer (default illustrations-render.js); ?kind= is read by the renderer. -->
<script type="module">import("./" + (new URLSearchParams(location.search).get("renderer") || "illustrations-render.js"));</script></html>
2 changes: 1 addition & 1 deletion content/home/2-areas.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ weight = 20
title = "Education & Pedagogy"
blurb = "Find, access and reuse teaching and mentoring materials."
image = "area-education"
alt = "Two green brick towers joined by an arch rising from an open book."
alt = "A stack of brick books in different colours, topped with a mortarboard."
links = [
{ url = "resources/" },
{ url = "lesson-plans/" },
Expand Down
2 changes: 1 addition & 1 deletion content/welcome/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ areas:
- key: edu
title: "Education & Pedagogy"
image: area-education
alt: "Two green brick towers joined by an arch rising from an open book."
alt: "A stack of brick books in different colours, topped with a mortarboard."
links:
- title: "Educational Nexus"
text: "FORRT's teaching projects and resources in one place."
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>{{ .Title }}</h1>
{{ with .Params.subtitle }}<p class="standfirst">{{ . | markdownify | emojify }}</p>{{ end }}
{{ if eq $kind "categories" }}<p class="standfirst">Each post in <a href="{{ relref . "/post" }}">news and announcements</a> has one of these {{ len .Data.Terms }} categories.</p>{{ end }}
{{/* The directory's illustration beside the title, as these are resources from the same collection. */}}
{{ if $topic }}{{ with resources.Get "images/doors/area-education.webp" }}<figure class="topic-plate-head"><img src="{{ .RelPermalink }}" alt="" width="{{ .Width }}" height="{{ .Height }}"></figure>{{ end }}{{ end }}
{{ if $topic }}{{ with resources.Get "images/doors/area-education-bricks.webp" }}<figure class="topic-plate-head"><img src="{{ .RelPermalink }}" alt="" width="{{ .Width }}" height="{{ .Height }}"></figure>{{ end }}{{ end }}
{{ if $topic }}<p class="topic-index__actions"><a class="btn btn-primary" href="{{ relref . "/clusters" }}">Browse the {{ with hugo.Data.clusters_v4 }}{{ len .clusters }}{{ else }}11{{ end }} current clusters</a> <a class="btn btn-outline-primary" href="{{ relref . "/resources" }}">Search all resources</a></p>{{ end }}
</header>
{{ with .Content }}<div class="article-style">{{ partial "doors/content" . }}</div>{{ end }}
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/doors/area_plate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{/* An area plate without its ground shadow, so the bricks centre in their door.
Context: dict "image" (name in assets/images/doors/), "alt", optional "lazy".
The -bricks copies come from scripts/rebrand/area_plate_bricks.py. */}}
{{ $image := resources.Get (printf "images/doors/%s-bricks.webp" .image) }}
<div class="area-plate"><img src="{{ $image.RelPermalink }}" alt="{{ .alt }}" width="{{ $image.Width }}" height="{{ $image.Height }}"{{ if .lazy }} loading="lazy"{{ end }}></div>
3 changes: 1 addition & 2 deletions layouts/partials/doors/home/areas.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
<h2 id="areas-h" class="visually-hidden">What FORRT does</h2>
<div class="areas">
{{ range .Params.area }}
{{ $image := resources.Get (printf "images/doors/%s.webp" .image) }}
<article class="area area-{{ .key }}" aria-labelledby="area-{{ .key }}-h">
<div class="area-plate"><img src="{{ $image.RelPermalink }}" alt="{{ .alt }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy"></div>
{{ partial "doors/area_plate" (dict "image" .image "alt" .alt "lazy" true) }}
<div class="area-body">
<h3 id="area-{{ .key }}-h">{{ .title }}</h3>
<p>{{ .blurb }}</p>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/doors/topic_resources.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{{ $types := slice }}
{{ range $index.facets }}{{ if eq .key "type" }}{{ range $v := .values }}{{ with index $typeCount $v.slug }}{{ $types = $types | append (dict "slug" $v.slug "label" $v.label "count" . "sort" (sub 10000 .)) }}{{ end }}{{ end }}{{ end }}{{ end }}
{{ $types = sort $types "sort" }}
{{ $plate := resources.Get "images/doors/area-education.webp" }}
{{ $plate := resources.Get "images/doors/area-education-bricks.webp" }}
<div class="article-style cluster-resources-list">
<div class="topic-head">
<section class="topic-now" aria-labelledby="topic-now-title">
Expand All @@ -58,7 +58,7 @@ <h2 id="topic-now-title" class="visually-hidden">These resources by current clus
{{ end }}
</ol>
</section>
<figure class="heading-plate topic-plate"><img src="{{ $plate.RelPermalink }}" alt="Two green brick towers joined by an arch rising from an open book." width="{{ $plate.Width }}" height="{{ $plate.Height }}"></figure>
<figure class="heading-plate topic-plate"><img src="{{ $plate.RelPermalink }}" alt="A stack of brick books in different colours, topped with a mortarboard." width="{{ $plate.Width }}" height="{{ $plate.Height }}"></figure>
</div>
<div class="topic-toolbar">
<div class="list-filter topic-tools" data-noun="resources" data-list="#now-{{ (index $groups 0).key }}" data-no-jump hidden>
Expand Down
2 changes: 1 addition & 1 deletion layouts/replication-hub/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h1>{{ .Title }}</h1>
<p class="lede">FORRT's open, crowd-sourced library tracking replication and computational reproduction attempts across the sciences and humanities.</p>
{{ partial "doors/page_actions" . }}
</div>
{{ with resources.Get "images/doors/area-research.webp" }}
{{ with resources.Get "images/doors/area-research-bricks.webp" }}
{{ $w := .Resize "440x webp q80" }}
<figure class="heading-plate heading-plate-research" aria-hidden="true"><img src="{{ $w.RelPermalink }}" width="{{ $w.Width }}" height="{{ $w.Height }}" alt=""></figure>
{{ end }}
Expand Down
4 changes: 2 additions & 2 deletions layouts/replication-hub/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<h1>{{ .Title }}</h1>
<p class="lede">Completed and ongoing large-scale projects summarising replication and computational reproducibility efforts across sciences and humanities.</p>
</div>
{{ with resources.Get "images/doors/area-research.webp" }}
{{ with resources.Get "images/doors/area-research-bricks.webp" }}
{{ $w := .Resize "440x webp q80" }}
<figure class="heading-plate heading-plate-research" aria-hidden="true"><img src="{{ $w.RelPermalink }}" width="{{ $w.Width }}" height="{{ $w.Height }}" alt=""></figure>
{{ end }}
Expand Down Expand Up @@ -233,7 +233,7 @@ <h1>{{ .Title }}</h1>
<div>
<h1>{{ .Title }}</h1>
</div>
{{ with resources.Get "images/doors/area-research.webp" }}
{{ with resources.Get "images/doors/area-research-bricks.webp" }}
{{ $w := .Resize "440x webp q80" }}
<figure class="heading-plate heading-plate-research" aria-hidden="true"><img src="{{ $w.RelPermalink }}" width="{{ $w.Width }}" height="{{ $w.Height }}" alt=""></figure>
{{ end }}
Expand Down
Loading
Loading