About
Contour Land is a full-screen interactive HTML5 Canvas and React TypeScript visualization that renders animated, organic topographic elevation contours inspired by hypsometric terrain mapping.
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Contour Land Neon to your project and fits it to your theme.
Code
How Contour Land Neon is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
import React, { useEffect, useRef } from 'react';
interface HypsometricStop {
pos: number;
r: number;
g: number;
b: number;
}
interface RGBColor {
r: number;
g: number;
b: number;
}
interface RingPoint {
x: number;
y: number;
prox: number;
}
interface PointerState {
x: number;
y: number;
targetX: number;
targetY: number;
active: boolean;
intensity: number;
}
interface SimulationState {
width: number;
height: number;
dpr: number;
rings: number;
segments: number;
time: number;
pointer: PointerState;
}
// Organic 3-lobe elevation dataset forming a smooth curved triangular silhouette
const ELEVATION_DATA: number[] = [88, 32, 92, 30, 86, 34];
// Hypsometric terrain color palette from center peak (0.0) to outer valley (1.0)
const HYPSOMETRIC_STOPS: HypsometricStop[] = [
{ pos: 0.0, r: 250, g: 237, b: 205 }, // #faedcd - Highland cream (peak)
{ pos: 0.12, r: 246, g: 189, b: 96 }, // #f6bd60 - Golden sand
{ pos: 0.24, r: 244, g: 162, b: 97 }, // #f4a261 - Warm sand
{ pos: 0.36, r: 224, g: 122, b: 95 }, // #e07a5f - Terracotta
{ pos: 0.48, r: 188, g: 108, b: 37 }, // #bc6c25 - Deep ochre clay
{ pos: 0.58, r: 164, g: 74, b: 34 }, // #a44a22 - Burnt sienna
{ pos: 0.68, r: 212, g: 163, b: 115 }, // #d4a373 - Sandy ochre
{ pos: 0.77, r: 138, g: 129, b: 76 }, // #8a814c - Olive soil
{ pos: 0.85, r: 96, g: 108, b: 56 }, // #606c38 - Olive moss green
{ pos: 0.92, r: 116, g: 198, b: 157 }, // #74c69d - Sage green
{ pos: 0.96, r: 45, g: 106, b: 79 }, // #2d6a4f - Forest green
{ pos: 1.0, r: 27, g: 67, b: 50 }, // #1b4332 - Deep moss green (outer valley)
];
/**
* Interpolates RGB color from the hypsometric palette based on normalized elevation t (0 = peak, 1 = valley)
*/
function getHypsometricColor(t: number): RGBColor {
const clamped = Math.max(0, Math.min(1, t));
for (let i = 0; i < HYPSOMETRIC_STOPS.length - 1; i++) {
const curr = HYPSOMETRIC_STOPS[i];
const next = HYPSOMETRIC_STOPS[i + 1];
if (clamped >= curr.pos && clamped <= next.pos) {
const localT = (clamped - curr.pos) / (next.pos - curr.pos);
return {
r: Math.round(curr.r + (next.r - curr.r) * localT),
g: Math.round(curr.g + (next.g - curr.g) * localT),
b: Math.round(curr.b + (next.b - curr.b) * localT),
};
}
}
const last = HYPSOMETRIC_STOPS[HYPSOMETRIC_STOPS.length - 1];
return { r: last.r, g: last.g, b: last.b };
}
/**
* Evaluates organic 3-lobe shape modulation at angle theta using cyclic cosine interpolation
*/
function evaluateTerrainShape(theta: number, ringRatio: number, time: number): number {
const n = ELEVATION_DATA.length;
// Subtle baseline oscillation so the topography feels alive
const rotationOffset = -Math.PI * 0.52 + Math.sin(time * 0.18) * 0.08;
const normalizedAngle = (((theta - rotationOffset) % (Math.PI * 2)) + Math.PI * 2) % (Math.PI * 2);
const exactIdx = (normalizedAngle / (Math.PI * 2)) * n;
const i0 = Math.floor(exactIdx) % n;
const i1 = (i0 + 1) % n;
const frac = exactIdx - Math.floor(exactIdx);
// Cosine interpolation for smooth ridges and valleys without sharp corners
const smoothFrac = (1 - Math.cos(frac * Math.PI)) * 0.5;
const v0 = (ELEVATION_DATA[i0] - 50) / 50;
const v1 = (ELEVATION_DATA[i1] - 50) / 50;
const baseMod = v0 + (v1 - v0) * smoothFrac;
// Secondary harmonic wave for natural variation across elevation layers
const harmonic = Math.sin(theta * 3 + time * 0.65 - ringRatio * 2.1) * 0.11 * (1 - ringRatio * 0.35);
return baseMod + harmonic;
}
/**
* Interactive Topographic Contour Land Visualization Component
* - Deep obsidian earth background (#060705) with warm central ambient glow
* - 16 organic 3-lobe contour rings with continuous outward radial ripple waves
* - Hypsometric earth palette (cream peak -> terracotta/sienna -> ochre -> sage & forest green)
* - Progressive stroke thickness increasing toward the core
* - Cursor proximity effects: elastic geometric distortion, local segment glow, and survey spotlight
*/
export default function App() {
const canvasRef = useRef<HTMLCanvasElement | null>(null);
const titleRef = useRef<HTMLHeadingElement | null>(null);
useEffect(() => {
// Load Plus Jakarta Sans font dynamically for crisp geometric typography
const fontLinkId = 'plus-jakarta-sans-font';
if (!document.getElementById(fontLinkId)) {
const link = document.createElement('link');
link.id = fontLinkId;
link.rel = 'stylesheet';
link.href = 'https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap';
document.head.appendChild(link);
}
const canvas = canvasRef.current;
if (!canvas) return;
const ctx = canvas.getContext('2d');
if (!ctx) return;
const state: SimulationState = {
width: 0,
height: 0,
dpr: Math.min(window.devicePixelRatio || 1, 2),
rings: 16,
segments: 260,
time: 0,
pointer: {
x: -9999,
y: -9999,
targetX: -9999,
targetY: -9999,
active: false,
intensity: 0,
},
};
let animationFrameId = 0;
/**
* Adjusts canvas resolution to match viewport dimensions and device pixel ratio
*/
const resizeCanvas = () => {
state.width = window.innerWidth;
state.height = window.innerHeight;
state.dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = state.width * state.dpr;
canvas.height = state.height * state.dpr;
ctx.setTransform(state.dpr, 0, 0, state.dpr, 0, 0);
};
/**
* Renders central warm ambient glow and soft topographic survey spotlight following the cursor
*/
const drawAmbientLighting = (cx: number, cy: number, maxRadius: number) => {
// 1. Warm earth glow at the central peak
const centerGlow = ctx.createRadialGradient(cx, cy, 4, cx, cy, maxRadius * 0.85);
centerGlow.addColorStop(0, 'rgba(188, 108, 37, 0.16)');
centerGlow.addColorStop(0.45, 'rgba(164, 74, 34, 0.06)');
centerGlow.addColorStop(1, 'rgba(6, 7, 5, 0)');
ctx.fillStyle = centerGlow;
ctx.fillRect(0, 0, state.width, state.height);
// 2. Soft spotlight following the pointer
if (state.pointer.intensity > 0.005) {
const spotRadius = Math.min(state.width, state.height) * 0.28;
const cursorGlow = ctx.createRadialGradient(
state.pointer.x,
state.pointer.y,
2,
state.pointer.x,
state.pointer.y,
spotRadius
);
const alpha = 0.13 * state.pointer.intensity;
cursorGlow.addColorStop(0, `rgba(246, 189, 96, ${alpha})`);
cursorGlow.addColorStop(0.45, `rgba(224, 122, 95, ${alpha * 0.45})`);
cursorGlow.addColorStop(1, 'rgba(6, 7, 5, 0)');
ctx.fillStyle = cursorGlow;
ctx.fillRect(0, 0, state.width, state.height);
}
};
/**
* Renders all 16 contour rings with radial ripple waves and cursor proximity interaction
*/
const render = () => {
// Clear deep obsidian earth background
ctx.fillStyle = '#060705';
ctx.fillRect(0, 0, state.width, state.height);
const minDim = Math.min(state.width, state.height);
const maxRadius = minDim * 0.45;
const minRadius = minDim * 0.115;
// Subtle parallax shift on the contour center as cursor moves
const normX =
state.pointer.intensity > 0 ? ((state.pointer.x / state.width) * 2 - 1) * state.pointer.intensity : 0;
const normY =
state.pointer.intensity > 0 ? ((state.pointer.y / state.height) * 2 - 1) * state.pointer.intensity : 0;
const cx = state.width * 0.5 - normX * 10;
const cy = state.height * 0.5 - normY * 10;
// Synchronize subtle parallax shift and responsive font scale for "Contour Land" inside the innermost ring
if (titleRef.current) {
const innerDiameter = minRadius * 1.45;
const baseSize = Math.max(9.5, Math.min(16, innerDiameter * 0.115));
titleRef.current.style.fontSize = `${baseSize.toFixed(1)}px`;
titleRef.current.style.transform = `translate3d(${(-normX * 10).toFixed(2)}px, ${(-normY * 10).toFixed(2)}px, 0)`;
}
// Draw ambient lighting and cursor spotlight
drawAmbientLighting(cx, cy, maxRadius);
// Cursor interaction radius responsive to viewport size
const interactionRadius = Math.max(150, minDim * 0.24);
const interactionRadiusSq = interactionRadius * interactionRadius;
const isPointerActive = state.pointer.intensity > 0.01;
// Render each contour ring from inner peak (i = 0) to outer valley (i = rings - 1)
for (let i = 0; i < state.rings; i++) {
const t = i / (state.rings - 1); // 0.0 (center) -> 1.0 (outer edge)
// Radial ripple wave propagating outward from the center
const rippleWave = Math.sin(i * 0.65 - state.time * 2.6);
const rippleRadiusOffset = rippleWave * (minDim * 0.0055) * (0.35 + t * 0.65);
const rippleAmpBoost = 1 + rippleWave * 0.085;
const rippleLuminanceBoost = 0.88 + rippleWave * 0.14;
// Progressive base radius from center to outer edge
const easedT = Math.pow(t, 1.06);
const baseR = minRadius + easedT * (maxRadius - minRadius) + rippleRadiusOffset;
// Base hypsometric color for ring i
const baseColor = getHypsometricColor(t);
// Base opacity: bright at peak/upper slopes, smoothly fading at outer green valleys
const innerRamp = i === 0 ? 0.94 : 1.0;
const outerFade = Math.pow(1 - t, 1.48);
const baseAlpha = Math.max(0.035, innerRamp * outerFade * 0.94 * rippleLuminanceBoost);
// Progressive stroke thickness: thicker toward the center (~4.6px), finer toward outer edge (~0.65px)
const centerWeight = Math.pow(1 - t, 1.85);
const rippleThicknessBoost = 1 + rippleWave * 0.1 * (1 - t * 0.5);
const baseLineWidth = (0.65 + 3.95 * centerWeight) * rippleThicknessBoost;
// Compute deformed ring vertices and track maximum cursor proximity
const ringPoints: RingPoint[] = new Array(state.segments + 1);
let maxRingProximity = 0;
for (let s = 0; s <= state.segments; s++) {
const theta = (s / state.segments) * Math.PI * 2;
const mod = evaluateTerrainShape(theta, t, state.time);
// Lobe amplitude slightly accentuated along mid-slope contours
const lobeScale = (0.25 + 0.07 * Math.sin(t * Math.PI)) * rippleAmpBoost;
const r = Math.max(5, baseR * (1 + mod * lobeScale));
let px = cx + Math.cos(theta) * r;
let py = cy + Math.sin(theta) * r;
let localProx = 0;
// Effect 1: Elastic geometric field distortion when pointer approaches contour points
if (isPointerActive) {
const dx = px - state.pointer.x;
const dy = py - state.pointer.y;
const distSq = dx * dx + dy * dy;
if (distSq < interactionRadiusSq) {
const dist = Math.sqrt(distSq);
// Smooth bell-shaped falloff for organic bending without sharp kinks
const falloff = Math.pow(1 - dist / interactionRadius, 2.2);
localProx = falloff * state.pointer.intensity;
if (localProx > maxRingProximity) {
maxRingProximity = localProx;
}
// Radial repulsion vector from cursor with subtle micro-ripple
const invDist = dist > 0.001 ? 1 / dist : 0;
const dirX = dx * invDist;
const dirY = dy * invDist;
const microWave = Math.sin(dist * 0.08 - state.time * 5.0) * 0.18 + 1.0;
const pushStrength = 26 * localProx * microWave;
px += dirX * pushStrength;
py += dirY * pushStrength;
}
}
ringPoints[s] = { x: px, y: py, prox: localProx };
}
// Construct closed path from calculated vertices
ctx.beginPath();
ctx.moveTo(ringPoints[0].x, ringPoints[0].y);
for (let s = 1; s <= state.segments; s++) {
ctx.lineTo(ringPoints[s].x, ringPoints[s].y);
}
ctx.closePath();
// Draw base contour stroke with hypsometric color gradient
ctx.lineWidth = baseLineWidth;
ctx.strokeStyle = `rgba(${baseColor.r}, ${baseColor.g}, ${baseColor.b}, ${Math.min(1, baseAlpha)})`;
// Natural warm glow on inner peak rings
if (t < 0.38) {
const coreGlowFactor = 1 - t / 0.38;
ctx.shadowBlur = coreGlowFactor * 16;
ctx.shadowColor = `rgba(246, 189, 96, ${0.52 * coreGlowFactor})`;
} else {
ctx.shadowBlur = 0;
}
ctx.stroke();
ctx.shadowBlur = 0;
// Effect 2: Local segment accentuation and warm glow around cursor proximity
if (maxRingProximity > 0.02) {
ctx.save();
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
for (let s = 0; s < state.segments; s++) {
const p0 = ringPoints[s];
const p1 = ringPoints[s + 1];
const segProx = (p0.prox + p1.prox) * 0.5;
if (segProx > 0.02) {
// Blend base earth color with warm golden-amber highlight near cursor
const highlightMix = segProx * 0.65;
const hr = Math.round(baseColor.r + (255 - baseColor.r) * highlightMix);
const hg = Math.round(baseColor.g + (224 - baseColor.g) * highlightMix);
const hb = Math.round(baseColor.b + (150 - baseColor.b) * highlightMix);
const highlightAlpha = Math.min(1, segProx * 0.92);
ctx.beginPath();
ctx.moveTo(p0.x, p0.y);
ctx.lineTo(p1.x, p1.y);
ctx.lineWidth = baseLineWidth + segProx * 1.9;
ctx.strokeStyle = `rgba(${hr}, ${hg}, ${hb}, ${highlightAlpha})`;
ctx.shadowBlur = 14 * segProx;
ctx.shadowColor = `rgba(246, 189, 96, ${0.85 * segProx})`;
ctx.stroke();
}
}
ctx.restore();
}
}
};
/**
* Main 60fps animation loop with smooth spring/lerp pointer physics
*/
const animate = () => {
state.time += 0.016;
if (state.pointer.active) {
if (state.pointer.x < -5000) {
state.pointer.x = state.pointer.targetX;
state.pointer.y = state.pointer.targetY;
} else {
state.pointer.x += (state.pointer.targetX - state.pointer.x) * 0.16;
state.pointer.y += (state.pointer.targetY - state.pointer.y) * 0.16;
}
state.pointer.intensity += (1 - state.pointer.intensity) * 0.12;
} else {
state.pointer.intensity += (0 - state.pointer.intensity) * 0.07;
if (state.pointer.intensity < 0.002) {
state.pointer.intensity = 0;
}
}
render();
animationFrameId = requestAnimationFrame(animate);
};
// Event handlers for mouse, touch, and viewport resize
const handleMouseMove = (e: MouseEvent) => {
state.pointer.targetX = e.clientX;
state.pointer.targetY = e.clientY;
state.pointer.active = true;
};
const handleMouseLeave = () => {
state.pointer.active = false;
};
const handleTouchStart = (e: TouchEvent) => {
if (e.touches.length > 0) {
const touch = e.touches[0];
state.pointer.targetX = touch.clientX;
state.pointer.targetY = touch.clientY;
if (state.pointer.intensity < 0.05) {
state.pointer.x = touch.clientX;
state.pointer.y = touch.clientY;
}
state.pointer.active = true;
}
};
const handleTouchMove = (e: TouchEvent) => {
if (e.touches.length > 0) {
const touch = e.touches[0];
state.pointer.targetX = touch.clientX;
state.pointer.targetY = touch.clientY;
state.pointer.active = true;
}
};
const handleTouchEnd = () => {
state.pointer.active = false;
};
window.addEventListener('resize', resizeCanvas);
window.addEventListener('mousemove', handleMouseMove);
document.addEventListener('mouseleave', handleMouseLeave);
window.addEventListener('touchstart', handleTouchStart, { passive: true });
window.addEventListener('touchmove', handleTouchMove, { passive: true });
window.addEventListener('touchend', handleTouchEnd, { passive: true });
resizeCanvas();
animate();
return () => {
cancelAnimationFrame(animationFrameId);
window.removeEventListener('resize', resizeCanvas);
window.removeEventListener('mousemove', handleMouseMove);
document.removeEventListener('mouseleave', handleMouseLeave);
window.removeEventListener('touchstart', handleTouchStart);
window.removeEventListener('touchmove', handleTouchMove);
window.removeEventListener('touchend', handleTouchEnd);
};
}, []);
return (
<div className="relative w-screen h-screen overflow-hidden bg-[#060705] select-none touch-none">
{/* Fullscreen Topographic Contour Canvas */}
<canvas ref={canvasRef} className="block w-full h-full cursor-default" />
{/* Centered "Contour Land" Typography Overlay inside Innermost Contour Ring */}
<div
className="fixed inset-0 flex items-center justify-center pointer-events-none z-10"
aria-label="Contour Land"
>
<h1
ref={titleRef}
style={{
fontFamily: "'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif",
background: 'linear-gradient(180deg, #fffdf7 0%, #faedcd 55%, #f6bd60 100%)',
WebkitBackgroundClip: 'text',
WebkitTextFillColor: 'transparent',
filter:
'drop-shadow(0 2px 8px rgba(6, 7, 5, 0.96)) drop-shadow(0 0 14px rgba(246, 189, 96, 0.32))',
transition: 'transform 0.25s cubic-bezier(0.22, 1, 0.36, 1)',
}}
className="flex flex-col items-center justify-center gap-[0.28em] font-bold tracking-[0.34em] indent-[0.34em] uppercase text-center leading-[1.1] whitespace-nowrap"
>
<span>Contour</span>
<span className="font-normal text-[0.86em] tracking-[0.44em] indent-[0.44em] opacity-90">
Land
</span>
</h1>
</div>
</div>
);
}







