← Demos
Web Pages · Hello World

Nolan Donlea Hello World

Make a medieval hello world that when you click the the letters charge into a battle and sword fight. Hello is its own team and world is its own team. Make it a snowy field with a castle in the back.

by Nolan Donlea Sep 1, 2026 6 views 5.1 KB
Sandbox · nolan-donlea-hello-world · 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>Snowbound Hello World</title>
<style>
  *{box-sizing:border-box}
  html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#dcecf4}
  body{font-family:Georgia,serif;color:#17314a}
  canvas{display:block;width:100%;height:100%;cursor:pointer;outline:none}
  canvas:focus{box-shadow:inset 0 0 0 4px #c28b35}
</style>
</head>
<body>
<canvas id="scene" tabindex="0" aria-label="Snowbound hello world. Click to make the letters charge and sword fight."></canvas>
<script>
const c=document.getElementById("scene"),x=c.getContext("2d");
let W,H,dpr,t=0,running=false,last=0,snow=[];
const hello=[..."hello"], world=[..."world"];
function resize(){
  dpr=Math.min(devicePixelRatio||1,2); W=innerWidth; H=innerHeight;
  c.width=W*dpr;c.height=H*dpr;x.setTransform(dpr,0,0,dpr,0,0);
  snow=Array.from({length:Math.max(70,Math.floor(W/12))},()=>({
    x:Math.random()*W,y:Math.random()*H,r:Math.random()*2.4+.6,
    s:Math.random()*.35+.15,d:Math.random()*Math.PI*2
  }));
}
addEventListener("resize",resize); resize();
function roundRect(ctx,a,b,w,h,r){
  ctx.beginPath();ctx.roundRect(a,b,w,h,r);ctx.fill();
}
function castle(){
  const base=H*.43, scale=Math.min(W/900,1.2), cw=180*scale;
  x.fillStyle="#a9c0cc"; x.fillRect(W/2-cw*.58,base,cw*1.16,H*.2);
  x.fillStyle="#809baa";
  for(let i=-1;i<=1;i++){
    let tx=W/2+i*cw*.48-34*scale;
    x.fillRect(tx,base-65*scale,68*scale,85*scale);
    x.beginPath();x.moveTo(tx-8*scale,base-65*scale);x.lineTo(tx+34*scale,base-103*scale);x.lineTo(tx+76*scale,base-65*scale);x.closePath();x.fill();
    x.fillStyle="#526f80";x.fillRect(tx+25*scale,base-38*scale,17*scale,38*scale);
    x.fillStyle="#809baa";
  }
  x.fillStyle="#718e9e";
  for(let i=0;i<8;i++)x.fillRect(W/2-cw*.54+i*27*scale,base+12*scale,12*scale,8*scale);
  x.fillStyle="#334f62";x.beginPath();x.arc(W/2,base+58*scale,29*scale,Math.PI,0);x.fill();
  x.fillStyle="#d6e8ee";x.fillRect(W/2-29*scale,base+58*scale,58*scale,18*scale);
}
function ground(){
  let g=x.createLinearGradient(0,H*.5,0,H);g.addColorStop(0,"#edf8fb");g.addColorStop(1,"#b9d7e4");
  x.fillStyle=g;x.fillRect(0,H*.52,W,H*.48);
  x.fillStyle="rgba(255,255,255,.8)";
  x.beginPath();x.moveTo(0,H*.72);for(let i=0;i<=W;i+=55)x.quadraticCurveTo(i+27,H*.68+Math.sin(i)*8,i+55,H*.72);x.lineTo(W,H);x.lineTo(0,H);x.fill();
}
function knight(ch,px,py,team,side,ang){
  x.save();x.translate(px,py);x.rotate(ang||0);
  let col=team?"#9b443d":"#315f7c", dark=team?"#71302f":"#214457";
  x.strokeStyle=dark;x.lineWidth=3;x.lineCap="round";
  x.fillStyle=col;roundRect(x,-19,-35,38,42,8);
  x.fillStyle="#dfeef1";x.beginPath();x.arc(0,-45,17,0,Math.PI*2);x.fill();
  x.fillStyle=dark;roundRect(x,-17,-51,34,13,5);
  x.strokeStyle="#fff";x.lineWidth=2;x.beginPath();x.moveTo(-7,-49);x.lineTo(-7,-40);x.moveTo(0,-51);x.lineTo(0,-39);x.moveTo(7,-49);x.lineTo(7,-40);x.stroke();
  x.fillStyle=team?"#e2b345":"#cbdbe2";x.font="bold 25px Georgia";x.textAlign="center";x.fillText(ch,0,-4);
  x.strokeStyle="#6a4a2b";x.lineWidth=4;
  x.beginPath();x.moveTo(side*15,-22);x.lineTo(side*47,-61);x.stroke();
  x.strokeStyle="#d8e9ed";x.lineWidth=3;x.beginPath();x.moveTo(side*39,-65);x.lineTo(side*52,-53);x.stroke();
  x.restore();
}
function draw(){
  let sky=x.createLinearGradient(0,0,0,H*.65);sky.addColorStop(0,"#709bb6");sky.addColorStop(1,"#dceef3");
  x.fillStyle=sky;x.fillRect(0,0,W,H); castle();ground();
  x.fillStyle="rgba(23,49,74,.9)";x.textAlign="center";x.font="bold clamp(34px,8vw,76px) Georgia";
  x.fillText("hello world",W/2,Math.min(H*.2,145));
  x.font="14px Georgia";x.fillStyle="rgba(23,49,74,.65)";
  x.fillText(running?"⚔  clash of letters  ⚔":"click the letters",W/2,Math.min(H*.27,192));
  let mid=W/2, y=Math.min(H*.72,Math.max(330,H-155)), spread=Math.min(W*.11,92);
  let p=Math.min(t/1.8,1), clash=Math.max(0,Math.min(1,(t-1.8)/1.3));
  hello.forEach((ch,i)=>{
    let start=90+i*spread*.38, target=mid-90+i*25;
    let px=start+(target-start)*(p<1?p:p);
    let bob=Math.sin(t*5+i)*2;
    knight(ch,px,y+bob,0,1, clash*.18*Math.sin(i));
  });
  world.forEach((ch,i)=>{
    let start=W-90-(4-i)*spread*.38,target=mid+48+i*25;
    let px=start+(target-start)*p,bob=Math.sin(t*5+i+2)*2;
    knight(ch,px,y+bob,1,-1,-clash*.18*Math.sin(i+1));
  });
  if(clash>.35){
    x.strokeStyle="#f3d27a";x.lineWidth=4;x.globalAlpha=(1-clash)*1.8;
    x.beginPath();x.moveTo(mid-20,y-75);x.lineTo(mid+20,y-115);x.moveTo(mid+20,y-75);x.lineTo(mid-20,y-115);x.stroke();x.globalAlpha=1;
  }
  x.fillStyle="rgba(255,255,255,.8)";
  snow.forEach(s=>{s.y+=s.s;if(s.y>H)s.y=-4;s.x+=Math.sin(t+s.d)*.12;x.beginPath();x.arc(s.x,s.y,s.r,0,7);x.fill()});
}
function loop(now){let dt=Math.min((now-last)/1000,.05);last=now;if(running){t+=dt;if(t>4.3)running=false}draw();requestAnimationFrame(loop)}
function activate(){running=true;t=0}
c.addEventListener("click",activate);
c.addEventListener("keydown",e=>{if(e.key==="Enter"||e.key===" "){e.preventDefault();activate()}});
requestAnimationFrame(loop);
</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 Nolan Donlea. 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.