← Demos
Web Pages · Hello World

Hello World Run

A 2D runner style game where the character running is the phrase "hello world!"

by Jeffrey Vest Aug 27, 2026 7 views 5.3 KB
Sandbox · hello-world-run · no access to your account
View source — the whole page is this one file
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Hello World Runner</title>
<style>
*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden;background:#10162d;color:#fff;font-family:system-ui,-apple-system,Segoe UI,sans-serif}body{display:grid;place-items:center}main{width:100%;height:100%;position:relative;max-width:1200px;max-height:760px;background:#172044;overflow:hidden;box-shadow:0 0 60px #050817}canvas{display:block;width:100%;height:100%}.hud{position:absolute;top:20px;left:24px;right:24px;display:flex;justify-content:space-between;align-items:center;pointer-events:none}.brand{font-weight:800;letter-spacing:.08em;color:#9de7ff;font-size:clamp(12px,2vw,17px)}.score{font-size:clamp(18px,3vw,28px);font-weight:800;color:#fff}.help{position:absolute;bottom:20px;left:50%;transform:translateX(-50%);color:#b9c4eb;font-size:13px;letter-spacing:.04em;text-align:center;white-space:nowrap}button{font:inherit;color:#fff;background:#ff6b8b;border:0;border-radius:999px;padding:12px 22px;font-weight:800;cursor:pointer;box-shadow:0 7px 20px #ff557755}button:focus-visible,canvas:focus-visible{outline:3px solid #fff;outline-offset:4px}.panel{position:absolute;inset:0;display:grid;place-items:center;text-align:center;background:#10162d66}.card{padding:28px 34px;border:1px solid #ffffff22;border-radius:24px;background:#18234ddd;backdrop-filter:blur(8px);box-shadow:0 15px 50px #080d25aa}.card h1{font-size:clamp(30px,7vw,70px);margin:0 0 8px;color:#9de7ff;letter-spacing:-.06em}.card p{margin:0 0 22px;color:#d4dbfa}.hidden{display:none}
</style>
</head>
<body>
<main>
<canvas id="game" tabindex="0" aria-label="Hello world runner game"></canvas>
<div class="hud"><div class="brand">HELLO WORLD RUN</div><div class="score">0000</div></div>
<div class="help">SPACE / ↑ / TAP TO JUMP</div>
<div class="panel" id="panel"><div class="card"><h1>hello world!</h1><p>Run the words. Dodge the dots.</p><button id="start">Start running</button></div></div>
</main>
<script>
const c=document.querySelector("canvas"),x=c.getContext("2d"),scoreEl=document.querySelector(".score"),panel=document.querySelector(".panel"),start=document.querySelector("#start");
let W,H,d=1,run=false,over=false,t=0,last=0,score=0,speed=5,ground=0,obs=[],next=80,player={y:0,vy:0};
function size(){d=Math.min(devicePixelRatio,2);W=c.clientWidth;H=c.clientHeight;c.width=W*d;c.height=H*d;x.setTransform(d,0,0,d,0,0);ground=H*.79}
function reset(){obs=[];score=0;speed=5;next=60;player.y=0;player.vy=0;over=false;run=true;panel.classList.add("hidden");c.focus();last=performance.now();requestAnimationFrame(loop)}
function jump(){if(!run){reset();return}if(player.y===0){player.vy=-14}}
function key(e){if(["Space","ArrowUp"].includes(e.code)){e.preventDefault();jump()}if(e.code==="Enter"&&over)reset()}
start.onclick=reset;c.addEventListener("pointerdown",jump);addEventListener("keydown",key);addEventListener("resize",size);size();
function rounded(a,b,w,h,r){x.beginPath();x.roundRect(a,b,w,h,r);x.fill()}
function draw(now){
 let sky=x.createLinearGradient(0,0,0,H);sky.addColorStop(0,"#172653");sky.addColorStop(1,"#342052");x.fillStyle=sky;x.fillRect(0,0,W,H);
 x.fillStyle="#ffbf69";x.globalAlpha=.8;x.beginPath();x.arc(W*.78,H*.22,42,0,7);x.fill();x.globalAlpha=1;
 for(let i=0;i<9;i++){let xx=(i*170-(t*.25)%170)-30; x.fillStyle="#26315b";x.fillRect(xx,ground-55-(i%3)*35,75,55+(i%3)*35);x.fillStyle="#56618b";for(let q=0;q<3;q++)x.fillRect(xx+12+q*19,ground-40-(i%3)*35,6,9)}
 x.fillStyle="#15192e";x.fillRect(0,ground,W,H-ground);x.strokeStyle="#55527c";x.lineWidth=3;x.setLineDash([25,25]);x.lineDashOffset=-t*speed;x.beginPath();x.moveTo(0,ground+42);x.lineTo(W,ground+42);x.stroke();x.setLineDash([]);
 for(const o of obs){x.fillStyle="#ff6b8b";rounded(o.x,ground-o.h,o.w,o.h,9);x.fillStyle="#ffb07c";x.beginPath();x.arc(o.x+o.w/2,ground-o.h-5,5,0,7);x.fill()}
 let bob=Math.sin(t*.25)*2, px=W*.18, py=ground-27-player.y+bob, text="hello world!",tw=Math.min(142,W*.31), fs=tw/7.9;
 x.shadowColor="#72e0ff";x.shadowBlur=18;x.fillStyle="#9de7ff";rounded(px,py-fs*.8,tw,fs*1.25,fs*.32);x.shadowBlur=0;
 x.fillStyle="#102044";x.font=`800 ${fs}px system-ui`;x.textAlign="center";x.textBaseline="middle";x.fillText(text,px+tw/2,py-fs*.18);
 x.strokeStyle="#9de7ff";x.lineWidth=4;let leg=Math.sin(t*.35)*6;x.beginPath();x.moveTo(px+tw*.3,py+fs*.45);x.lineTo(px+tw*.22+leg,py+fs*1.05);x.moveTo(px+tw*.72,py+fs*.45);x.lineTo(px+tw*.8-leg,py+fs*1.05);x.stroke();x.textAlign="start";
}
function loop(now){if(!run)return;let dt=Math.min((now-last)/16.67,2);last=now;t+=dt;score+=dt*.12;speed+=dt*.001;
 player.vy+=.7*dt;player.y-=player.vy*dt;if(player.y<0){player.y=0;player.vy=0}
 next-=dt;if(next<0){let h=24+Math.random()*38;obs.push({x:W+20,w:18+Math.random()*18,h});next=65+Math.random()*75}
 obs.forEach(o=>o.x-=speed*dt);obs=obs.filter(o=>o.x>-60);
 let px=W*.18,tw=Math.min(142,W*.31),py=ground-27-player.y;
 for(const o of obs)if(px+tw-8>o.x&&px+8<o.x+o.w&&py>ground-o.h-8){run=false;over=true;panel.classList.remove("hidden");panel.querySelector("h1").textContent="hello world?";panel.querySelector("p").textContent=`You ran ${String(Math.floor(score)).padStart(4,"0")} metres. Try again!`;start.textContent="Run again";break}
 scoreEl.textContent=String(Math.floor(score)).padStart(4,"0");draw(now);if(run)requestAnimationFrame(loop)}
draw(0);
</script>
</body>
</html>

Reaches out to

Nothing. This page is entirely self-contained and contacts no other website when it runs.

Licence

Published on Globefin under the MIT License. You may copy, change, and reuse this page, including commercially — just keep the notice below with it.

Copyright © 2026 Jeffrey Vest. Licensed under the MIT License. Published on Globefin.

Provided as is, without warranty. Any external libraries it loads keep their own licences. Terms →

Sandbox

Scripts run, but the demo has its own throwaway origin. It can't read your session or cookies, can't reach the page around it, and can't navigate your tab. Don't enter real passwords or personal data into any demo.