diff --git a/skillgraph-web/app/page.tsx b/skillgraph-web/app/page.tsx index 14b3d87..80e96d8 100644 --- a/skillgraph-web/app/page.tsx +++ b/skillgraph-web/app/page.tsx @@ -9,7 +9,7 @@ import { } from "lucide-react"; import { Button } from "@/components/ui/button"; import SkillGraphLogo from "@/components/SkillGraphLogo"; -import WallStreetVideo from "@/components/WallStreetVideo"; +import GridGlowBackground from "@/components/GridGlowBackground"; import PageTransition from "@/components/PageTransition"; // Live counts from /api/stats (cached at the CDN); nothing is shown until real numbers arrive @@ -113,7 +113,7 @@ const LandingPage = () => {
- +
{/* Ticker tape */} diff --git a/skillgraph-web/components/GridGlowBackground.tsx b/skillgraph-web/components/GridGlowBackground.tsx new file mode 100644 index 0000000..64b884b --- /dev/null +++ b/skillgraph-web/components/GridGlowBackground.tsx @@ -0,0 +1,188 @@ +"use client"; + +import { useEffect, useRef } from "react"; + +/** + * Landing-page background: a rising market chart and a small skill network, rendered as a + * glowing grid of gold cells with shimmer and occasional glitches (a "grid glow" effect). + * + * Everything is drawn on a canvas in the page, so there is no video player, no controls and no + * footage to license. The scene is drawn at one pixel per cell into a small offscreen canvas; + * each cell's brightness then sets the size and glow of its square on screen. + */ + +const CELL = 9; // on-screen cell size in CSS pixels +const FPS = 30; +const GOLD = [212, 175, 55] as const; // theme primary +const AMBER = [255, 196, 92] as const; // brightest cells +const GLITCH = [255, 120, 60] as const; // occasional warm glitch tint +const EMBER = [176, 92, 28] as const; // dim edges fade towards deep amber + +type Node = { x: number; y: number; vx: number; vy: number; r: number }; + +export default function GridGlowBackground() { + const canvasRef = useRef(null); + + useEffect(() => { + const canvas = canvasRef.current; + if (!canvas) return; + const ctx = canvas.getContext("2d", { alpha: false }); + const scene = document.createElement("canvas"); + const sctx = scene.getContext("2d", { willReadFrequently: true }); + if (!ctx || !sctx) return; + + const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches; + let cols = 0, rows = 0, dpr = 1, raf = 0, last = 0; + let nodes: Node[] = []; + let glitchRows: { row: number; shift: number; until: number }[] = []; + + const resize = () => { + const { clientWidth: w, clientHeight: h } = canvas; + dpr = Math.min(window.devicePixelRatio || 1, 1.5); + canvas.width = Math.round(w * dpr); + canvas.height = Math.round(h * dpr); + cols = Math.ceil(w / CELL); + rows = Math.ceil(h / CELL); + scene.width = cols; + scene.height = rows; + // A small network of "skills" drifting on the right-hand side + nodes = Array.from({ length: 9 }, (_, i) => ({ + x: cols * (0.58 + 0.38 * ((i * 37) % 100) / 100), + y: rows * (0.12 + 0.6 * ((i * 61) % 100) / 100), + vx: (((i * 13) % 7) - 3) * 0.004, + vy: (((i * 17) % 7) - 3) * 0.004, + r: 1.8 + (i % 3) * 0.8, + })); + }; + + // The scene, one pixel per cell: brightness becomes the cell's glow + const drawScene = (t: number) => { + sctx.fillStyle = "#000"; + sctx.fillRect(0, 0, cols, rows); + + // Rising market line with a soft filled area beneath it + const points: [number, number][] = []; + for (let x = 0; x <= cols; x++) { + const p = x / cols; + const trend = rows * (0.78 - 0.5 * p); + const wave = Math.sin(p * 9 + t * 0.6) * rows * 0.035 + Math.sin(p * 23 - t * 1.1) * rows * 0.015; + points.push([x, trend + wave]); + } + const area = sctx.createLinearGradient(0, rows * 0.25, 0, rows); + area.addColorStop(0, "rgba(255,255,255,0.32)"); + area.addColorStop(1, "rgba(255,255,255,0)"); + sctx.beginPath(); + sctx.moveTo(0, rows); + points.forEach(([x, y]) => sctx.lineTo(x, y)); + sctx.lineTo(cols, rows); + sctx.closePath(); + sctx.fillStyle = area; + sctx.fill(); + sctx.beginPath(); + points.forEach(([x, y], i) => (i ? sctx.lineTo(x, y) : sctx.moveTo(x, y))); + sctx.strokeStyle = "rgba(255,255,255,0.95)"; + sctx.lineWidth = 2.2; + sctx.stroke(); + + // Candles along the line + for (let x = 4; x < cols; x += 7) { + const [, y] = points[x]; + const h = 3 + Math.abs(Math.sin(x * 1.7 + t * 0.8)) * 6; + sctx.fillStyle = "rgba(255,255,255,0.55)"; + sctx.fillRect(x - 1, y - h - 2, 2, h); + } + + // Skill network: drifting nodes with links between nearby ones + for (const n of nodes) { + n.x += n.vx; n.y += n.vy; + if (n.x < cols * 0.5 || n.x > cols * 0.98) n.vx *= -1; + if (n.y < rows * 0.06 || n.y > rows * 0.75) n.vy *= -1; + } + sctx.lineWidth = 0.8; + for (let i = 0; i < nodes.length; i++) { + for (let j = i + 1; j < nodes.length; j++) { + const a = nodes[i], b = nodes[j]; + const d = Math.hypot(a.x - b.x, a.y - b.y); + if (d > cols * 0.22) continue; + sctx.strokeStyle = `rgba(255,255,255,${0.45 * (1 - d / (cols * 0.22))})`; + sctx.beginPath(); sctx.moveTo(a.x, a.y); sctx.lineTo(b.x, b.y); sctx.stroke(); + } + } + for (const n of nodes) { + const pulse = 0.75 + 0.25 * Math.sin(t * 2 + n.x); + sctx.fillStyle = `rgba(255,255,255,${pulse})`; + sctx.beginPath(); sctx.arc(n.x, n.y, n.r, 0, Math.PI * 2); sctx.fill(); + } + }; + + const render = (now: number) => { + const t = now / 1000; + drawScene(t); + const data = sctx.getImageData(0, 0, cols, rows).data; + + // Glitches: now and then a few rows slip sideways for a moment + if (!reduceMotion && Math.random() < 0.04) { + const row = Math.floor(Math.random() * rows); + glitchRows.push({ row, shift: Math.round((Math.random() - 0.5) * 8), until: now + 120 + Math.random() * 200 }); + } + glitchRows = glitchRows.filter(g => g.until > now); + const shiftFor = (r: number) => glitchRows.find(g => Math.abs(g.row - r) <= 1)?.shift ?? 0; + + ctx.setTransform(dpr, 0, 0, dpr, 0, 0); + ctx.fillStyle = "#050505"; + ctx.fillRect(0, 0, cols * CELL, rows * CELL); + + for (let r = 0; r < rows; r++) { + const shift = shiftFor(r); + for (let c = 0; c < cols; c++) { + const b = data[(r * cols + c) * 4] / 255; + // Faint grid everywhere, so the field reads as a dot matrix even where it's dark + const shimmer = reduceMotion ? 0 : (Math.sin(c * 0.9 + r * 1.3 + t * 3) + 1) * 0.5; + const level = b > 0.04 ? b : 0.025 + 0.02 * shimmer; + const x = (c + shift) * CELL, y = r * CELL; + const size = Math.max(1, CELL * (0.18 + 0.62 * Math.min(1, level * 1.4))); + const off = (CELL - size) / 2; + const flicker = !reduceMotion && b > 0.2 && Math.random() < 0.015; + const col = shift !== 0 && b > 0.1 ? GLITCH : level > 0.75 ? AMBER : level > 0.3 ? GOLD : b > 0.04 ? EMBER : GOLD; + const alpha = Math.min(1, (flicker ? 0.25 : 1) * (0.12 + level * 0.95)); + if (level > 0.25) { + // Soft glow behind bright cells + ctx.fillStyle = `rgba(${col[0]},${col[1]},${col[2]},${alpha * 0.28})`; + ctx.fillRect(x - 3, y - 3, CELL + 6, CELL + 6); + } + ctx.fillStyle = `rgba(${col[0]},${col[1]},${col[2]},${alpha})`; + ctx.fillRect(x + off, y + off, size, size); + } + } + }; + + const loop = (now: number) => { + raf = requestAnimationFrame(loop); + if (now - last < 1000 / FPS) return; + last = now; + render(now); + }; + + resize(); + if (reduceMotion) { + render(4000); // one still frame + } else { + raf = requestAnimationFrame(loop); + } + const onResize = () => { resize(); if (reduceMotion) render(4000); }; + window.addEventListener("resize", onResize); + return () => { + cancelAnimationFrame(raf); + window.removeEventListener("resize", onResize); + }; + }, []); + + return ( +