Skip to content
← Public packages

@kentcdodds/the-last-software-engineer

The Last Software Engineer: Kent C. Dodds's React Summit US 2026 talk deck. Judgment and product engineering in an AI era.

FollowForkOpen app

Files

buzz.js

233 lines · 9.3 KB · JavaScript
// "What do you actually do here?": a deterministic wall of hype drawn on a full-slide canvas.
//
// Every term instance has a fixed (seeded) target position, size, weight, rotation and color. On
// the beat, instances spawn at an accelerating rate and each lands on its target with an analytic
// damped spring (overshoot in position, rotation and scale), then keeps jostling on smooth noise.
// The settled state for a beat is the springs at rest with no jitter: that is what ?static, the
// overview, the speaker preview and any non-current view draw, so a beat always lands the same.
// The question stays a DOM element on a solid plate above the canvas.
;(() => {
	const deck = window.__deck
	const root = document.documentElement
	const section = document.getElementById('what-do-you-do')
	const canvas = section?.querySelector('canvas.buzz')
	if (!canvas) return
	const ctx = canvas.getContext('2d')
	const W = 1920
	const H = 1080

	// Real terms from the AI tooling hype cycle. No products, no invented names.
	const TERMS = [
		'prompt engineering', 'context engineering', 'loops 🌀', 'queues', 'graphs 📊', 'sub agents', 'flow engineering',
		'fine-tuning', '*automated* prompt engineering', 'reasoning', 'agents', 'rag', 'vector databases', 'mcp', 'cli',
		'vibe coding', 'skills', 'orchestration', 'computer use',
		'agentic workflows', 'multi-agent', 'agent swarms', 'background agents', 'autonomous agents', 'tool calling',
		'function calling', 'structured outputs', 'embeddings', 'GraphRAG', 'chain of thought', 'reasoning models',
		'test-time compute', 'context windows', 'prompt caching', 'evals', 'LLM-as-judge', 'guardrails', 'hallucinations',
		'RLHF', 'LoRA', 'distillation', 'quantization', 'mixture of experts', 'synthetic data', 'small language models',
		'AGENTS.md', 'memory', 'browser use', 'agentic coding', 'spec-driven development', 'human in the loop', 'copilots',
		'A2A', 'tokens', 'inference', 'world models', 'self-healing code', 'AGI',
	]
	const COUNT = 150
	// Pacing (Kent): one term at a time, slowly, for about 5 seconds; then it accelerates until the
	// wall is full at 10 seconds.
	const SLOW_SECONDS = 5
	const SPAWN_SECONDS = 10
	const LEADS = [
		// The first few, one at a time: the familiar ones, large, around (not under) the question.
		{ text: 'prompt engineering', x: 520, y: 190, size: 84, rot: -5 },
		{ text: 'agents', x: 1450, y: 860, size: 96, rot: 6 },
		{ text: 'context engineering', x: 1380, y: 200, size: 78, rot: 4 },
		{ text: 'mcp', x: 420, y: 880, size: 104, rot: -8 },
		{ text: 'vibe coding', x: 960, y: 950, size: 80, rot: 2 },
		{ text: 'rag', x: 960, y: 120, size: 92, rot: -3 },
	]

	// mulberry32: a tiny seeded PRNG, so the layout is identical on every load.
	const rng = (seed) => () => {
		seed |= 0
		seed = (seed + 0x6d2b79f5) | 0
		let t = Math.imul(seed ^ (seed >>> 15), 1 | seed)
		t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t
		return ((t ^ (t >>> 14)) >>> 0) / 4294967296
	}
	const rand = rng(20261117)
	const colors = ['--ink', '--ink', '--ink', '--muted', '--muted', '--accent-ink', '--accent-ink', '--packages', '--apps', '--warning']
	const fonts = ['--font-display', '--font-body']
	const words = Array.from({ length: COUNT }, (_, i) => {
		const r = rand()
		const angle = rand() * Math.PI * 2
		const dist = 140 + rand() * 260
		return {
			text: i < TERMS.length ? TERMS[i] : TERMS[Math.floor(rand() * TERMS.length)],
			x: -60 + rand() * (W + 120),
			y: 20 + rand() * (H - 40),
			size: Math.round(30 + 92 * r ** 2.1),
			weight: [400, 500, 600, 700, 800][Math.floor(rand() * 5)],
			font: fonts[rand() < 0.55 ? 0 : 1],
			rot: (rand() - 0.5) * (rand() < 0.25 ? 70 : 34) * (Math.PI / 180),
			color: colors[Math.floor(rand() * colors.length)],
			from: [Math.cos(angle) * dist, Math.sin(angle) * dist],
			fromRot: (rand() - 0.5) * 1.2,
			fromScale: 1.5 + rand() * 1.2,
			omega: 11 + rand() * 7,
			zeta: 0.32 + rand() * 0.2,
			jitter: rand() < 0.2 ? 14 + rand() * 18 : 2 + rand() * 6,
			freq: 0.6 + rand() * 2.4,
			phase: rand() * 100,
			order: rand(),
		}
	})
	// Spawn order is shuffled; the rate accelerates (gaps shrink), so it builds into a wall.
	words.sort((a, b) => a.order - b.order)
	// The leads come first, one at a time over the slow phase.
	// They are extra instances (every term in TERMS still appears in the wall too), with the same
	// seeded spring dynamics as the rest.
	words.unshift(...LEADS.map((lead, i) => ({
		...words[i],
		text: lead.text, x: lead.x, y: lead.y, size: lead.size, weight: 800, font: '--font-display',
		rot: (lead.rot * Math.PI) / 180, color: i % 2 ? '--accent-ink' : '--ink',
		spawn: 0.25 + (i * (SLOW_SECONDS - 0.6)) / (LEADS.length - 1),
	})))
	// Then the rest accelerate (gaps shrink) until the last one lands at SPAWN_SECONDS.
	const rest = words.length - LEADS.length
	words.forEach((w, i) => {
		if (i < LEADS.length) return
		const u = (i - LEADS.length) / (rest - 1)
		w.spawn = SLOW_SECONDS + (SPAWN_SECONDS - SLOW_SECONDS) * u ** 0.45
	})

	// Unit damped spring from 1 to 0 (analytic, so deterministic at any frame rate).
	const spring = (t, w, z) => {
		if (t <= 0) return 1
		const wd = w * Math.sqrt(1 - z * z)
		return Math.exp(-z * w * t) * (Math.cos(wd * t) + ((z * w) / wd) * Math.sin(wd * t))
	}

	let step = Number(section.dataset.step ?? 0)
	let mode = 'rest' // 'rest' | 'in' | 'out'
	let t0 = 0
	let raf = 0

	function resize() {
		const box = canvas.getBoundingClientRect()
		const k = box.width > 0 ? (box.width / W) * (window.devicePixelRatio || 1) : 1
		const w = Math.max(1, Math.round(W * k))
		const h = Math.max(1, Math.round(H * k))
		if (canvas.width !== w || canvas.height !== h) {
			canvas.width = w
			canvas.height = h
		}
		draw(mode === 'rest' ? null : (performance.now() - t0) / 1000)
	}

	// t = seconds since the beat began (null = settled state for the current step).
	function draw(t) {
		const k = canvas.width / W
		ctx.setTransform(k, 0, 0, k, 0, 0)
		ctx.clearRect(0, 0, W, H)
		if (step === 0 && mode !== 'out') return
		const cs = getComputedStyle(section)
		const v = {}
		for (const c of colors) v[c] ??= cs.getPropertyValue(c).trim()
		const f = { '--font-display': cs.getPropertyValue('--font-display').trim(), '--font-body': cs.getPropertyValue('--font-body').trim() }
		ctx.textAlign = 'center'
		ctx.textBaseline = 'middle'
		for (const w of words) {
			let x = w.x
			let y = w.y
			let rot = w.rot
			let scale = 1
			let alpha = 1
			if (t !== null && mode === 'in') {
				const local = t - w.spawn
				if (local <= 0) continue
				const s = spring(local, w.omega, w.zeta)
				x += w.from[0] * s
				y += w.from[1] * s
				rot += w.fromRot * s
				scale += (w.fromScale - 1) * s
				alpha = Math.min(1, local / 0.12)
				// Jostle on smooth noise once landed; grows in as the spring dies out.
				const j = w.jitter * (1 - Math.min(1, Math.abs(s)))
				const tt = t + w.phase
				x += j * (Math.sin(tt * w.freq) + 0.5 * Math.sin(tt * w.freq * 2.3 + 1.7))
				y += j * 0.6 * (Math.cos(tt * w.freq * 1.3) + 0.4 * Math.sin(tt * w.freq * 3.1))
				rot += (j / 400) * Math.sin(tt * w.freq * 0.7)
			} else if (t !== null && mode === 'out') {
				const local = Math.max(0, t - w.order * 0.25)
				alpha = Math.max(0, 1 - local / 0.35)
				if (alpha <= 0) continue
				y += 260 * local * local
				rot += w.fromRot * local
			}
			ctx.save()
			ctx.globalAlpha = alpha
			ctx.translate(x, y)
			ctx.rotate(rot)
			ctx.scale(scale, scale)
			ctx.font = `${w.weight} ${w.size}px ${f[w.font]}`
			ctx.fillStyle = v[w.color]
			ctx.fillText(w.text, 0, 0)
			ctx.restore()
		}
	}

	function stop() {
		cancelAnimationFrame(raf)
		raf = 0
	}
	function settle() {
		stop()
		mode = 'rest'
		draw(null)
	}
	function frame(now) {
		const t = (now - t0) / 1000
		draw(t)
		if (mode === 'out' && t > 0.7) return settle()
		raf = requestAnimationFrame(frame) // 'in' keeps jostling for as long as the slide is up
	}
	function go(to) {
		const from = step
		step = to
		const live = deck.getCurrentSlide() === section && root.dataset.motion === 'full'
		if (!live) return settle()
		stop()
		// Forward: the wall piles in. Back: the words drop away, then the beat settles (empty).
		mode = to > from ? 'in' : 'out'
		t0 = performance.now()
		raf = requestAnimationFrame(frame)
	}

	section.addEventListener('stepchange', (event) => go(event.detail.step))
	new MutationObserver(() => draw(mode === 'rest' ? null : (performance.now() - t0) / 1000)).observe(root, { attributes: true, attributeFilter: ['data-theme'] })
	const sync = () => {
		step = Number(section.dataset.step ?? 0)
		settle()
		resize()
		// Arriving on the full wall (navigating back) with motion on: keep it jostling.
		if (deck.getCurrentSlide() === section && root.dataset.motion === 'full' && step > 0) {
			mode = 'in'
			t0 = performance.now() - (SPAWN_SECONDS + 3) * 1000
			raf = requestAnimationFrame(frame)
		}
	}
	if (deck.isReady()) sync()
	else deck.on('ready', sync)
	deck.on('resize', resize)
	deck.on('slidechanged', (event) => {
		if (event.currentSlide === section || event.previousSlide === section) sync()
		else if (raf && deck.getCurrentSlide() !== section) settle()
	})
	document.fonts?.ready.then(resize)

	window.__buzz = {
		get step() { return step },
		get mode() { return mode },
		get running() { return !!raf },
		count: words.length,
		// Deterministic layout signature (same on every load) for tests.
		signature: () => words.reduce((s, w, i) => s + (w.x * 7 + w.y * 13 + w.rot * 1000 + w.size) * (i + 1), 0),
	}
})()