diff --git a/assets/covers/chapter_hello_algo.svg b/assets/covers/chapter_hello_algo.svg
index 2e99d1fd1..a00ef99f2 100644
--- a/assets/covers/chapter_hello_algo.svg
+++ b/assets/covers/chapter_hello_algo.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/assets/home/50aa7b2c8191c024/hero-motion.css b/assets/home/087f217bf2136799/hero-motion.css
similarity index 95%
rename from assets/home/50aa7b2c8191c024/hero-motion.css
rename to assets/home/087f217bf2136799/hero-motion.css
index 83527714e..786fe68d8 100644
--- a/assets/home/50aa7b2c8191c024/hero-motion.css
+++ b/assets/home/087f217bf2136799/hero-motion.css
@@ -108,21 +108,11 @@
transition: transform 240ms ease, filter 240ms ease;
}
-.hero-universe .hero-ground,
-.hero-universe .hero-links {
+.hero-universe .hero-ground {
translate: var(--hero-ground-x, 0px) var(--hero-ground-y, 0px);
pointer-events: none;
}
-.hero-universe .hero-links {
- opacity: .72;
- transition: filter 300ms ease;
-}
-
-.hero-universe .hero-network-active > .hero-links {
- filter: brightness(1.16) drop-shadow(0 0 2px rgba(126, 207, 196, 0.22));
-}
-
.hero-universe .hero-div > a.hero-selected > img {
transform: none;
filter: brightness(1.04) drop-shadow(0 0 3px rgba(147, 213, 204, 0.18));
@@ -194,8 +184,7 @@
@media (prefers-reduced-motion: reduce) {
.hero-universe .hero-div > a > img,
.hero-universe .hero-div > a > span,
- .hero-universe .hero-ground,
- .hero-universe .hero-links {
+ .hero-universe .hero-ground {
translate: none;
rotate: none;
transition: none;
@@ -227,7 +216,8 @@
}
.hero-universe .hero-objects-canvas[hidden] {
- display: none;
+ /* Three.js sets display:block inline; the fallback must hide its last frame. */
+ display: none !important;
}
/* Original art is a complete fallback; labels and hit areas remain native HTML. */
@@ -238,7 +228,7 @@
/* Immediate preference response also covers an already-paused animation clock. */
@media (prefers-reduced-motion: reduce) {
.hero-universe .hero-objects-canvas,
- .hero-universe .hero-motion-toggle { display: none; }
+ .hero-universe .hero-motion-toggle { display: none !important; }
.hero-universe .hero-div img.hero-replaced { opacity: 1; }
.hero-three-active .hero-stars { visibility: visible; }
}
diff --git a/assets/home/50aa7b2c8191c024/javascripts/hero-assets.js b/assets/home/087f217bf2136799/javascripts/hero-assets.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/hero-assets.js
rename to assets/home/087f217bf2136799/javascripts/hero-assets.js
diff --git a/assets/home/087f217bf2136799/javascripts/hero-flow-links.js b/assets/home/087f217bf2136799/javascripts/hero-flow-links.js
new file mode 100644
index 000000000..7622990c0
--- /dev/null
+++ b/assets/home/087f217bf2136799/javascripts/hero-flow-links.js
@@ -0,0 +1,233 @@
+import * as THREE from './vendor/three/three.module.min.js';
+
+// Art-directed spines in the original 1562 x 1134 composition. The open oval,
+// two inward sweeps and bottom title gap are retained; these are 3D curves,
+// not a sampled image and not a graph of straight planet-to-planet chords.
+const spines = [
+ {from:'backtracking', to:'divide_and_conquer', via:['searching'], points:[[59,484,-26],[150,245,-8],[440,92,-42],[581,92,-18]], spread:44},
+ {from:'backtracking', to:'greedy', via:['dynamic_programming'], points:[[59,484,-20],[-37,736,-28],[97,946,-28],[378,1072,-24]], spread:46},
+ {from:'heap', to:'stack_and_queue', via:['tree','array_and_linkedlist'], points:[[1357,136,-22],[1630,515,14],[1550,965,-40],[1104,1118,-24]], spread:44},
+ {from:'graph', to:'tree', points:[[1024,90,-30],[1210,165,-10],[1370,245,-36],[1478,419,-20]], spread:40},
+ {from:'sorting', to:'divide_and_conquer', points:[[355,549,-24],[390,370,4],[525,175,-36],[581,92,-18]], spread:44},
+ {from:'hashing', to:'tree', points:[[1123,406,-20],[1260,405,-32],[1320,415,6],[1478,419,-22]], spread:34},
+ {from:'hashing', to:'array_and_linkedlist', points:[[1123,406,-24],[1280,545,4],[1390,665,-38],[1442,817,-20]], spread:42},
+];
+
+export function createFlowLinks(targets) {
+ if (!targets.length) return null;
+ const positions=[],tangents=[],styles=[],paths=[],fractions=[],bindings=[],motions=[],indices=[];
+ const strands=17,segments=72;
+ const random = n => {const x=Math.sin(n*127.1+311.7)*43758.5453;return x-Math.floor(x);};
+
+ spines.forEach((definition, route) => {
+ const {points:[a,b,c,d]}=definition;
+ const routeSeed=701+route*43;
+ const spread=definition.spread*(.92+.16*random(routeSeed));
+ const mirrored=random(routeSeed+1)>.5;
+ const primary=mirrored?2:14,echo=16-primary;
+ const brushLanes=[4+Math.floor(random(routeSeed+2)*2),7+Math.floor(random(routeSeed+3)*2),10];
+ const dominant=brushLanes[Math.floor(random(routeSeed+4)*brushLanes.length)];
+ const fanPhase=random(routeSeed+5)*Math.PI*2;
+ const curve=new THREE.CubicBezierCurve3(...[a,b,c,d].map(([x,y,z])=>new THREE.Vector3(x-781,567-y,z)));
+ curve.arcLengthDivisions=256;
+ const length=curve.getLength();
+ // Seed once per route: geometry and timing stay stable on pause / resize.
+ const phase=random(routeSeed+6);
+ const speed=66+random(routeSeed+7)*38;
+ const gap=500+random(routeSeed+8)*300;
+ const tailLength=Math.min(42+random(routeSeed+9)*42,length*(.065+.04*random(routeSeed+10)));
+ const headLength=3.2+random(routeSeed+11)*2.5;
+ for(let lane=0;lane0)},selectionActive:{value:0},
+ startShift:{value:spines.map(()=>new THREE.Vector3())},
+ endShift:{value:spines.map(()=>new THREE.Vector3())},
+ teal:{value:new THREE.Color('#479d9d')},
+ pearl:{value:new THREE.Color('#def9ef')},
+ glow:{value:new THREE.Color('#effffb')},
+ blush:{value:new THREE.Color('#d7bab1')},
+ };
+ const material=new THREE.ShaderMaterial({
+ uniforms,transparent:true,depthTest:true,depthWrite:false,side:THREE.DoubleSide,
+ vertexShader:`
+ attribute vec3 curveTangent;
+ attribute vec4 pathStyle, strandStyle;
+ attribute vec3 fraction;
+ attribute vec4 binding,flowStyle;
+ uniform float routeEmphasis[${spines.length}];
+ uniform vec3 startShift[${spines.length}],endShift[${spines.length}];
+ uniform vec2 viewShift;
+ uniform float unit,pixelRatio;
+ varying vec4 travel, strand, motion;
+ varying vec2 shape, along;
+ varying float highlight,filamentOpacity,painted;
+ void main(){
+ vec3 point=(modelMatrix*vec4(position,1.)).xyz;
+ vec3 tangent=(modelMatrix*vec4(curveTangent,0.)).xyz;
+ int route=int(binding.x);
+ // Emphasize the complete connected bundle, not just pixels near a globe.
+ highlight=routeEmphasis[route];
+ float u=binding.y;
+ float blend=u*u*(3.-2.*u);
+ vec3 anchored=mix(startShift[route],endShift[route],blend);
+ vec3 anchorSlope=(endShift[route]-startShift[route])*6.*u*(1.-u)/strandStyle.z;
+ // Endpoint-only deformation preserves the oval's curvature; local
+ // Gaussian attraction to passing planets introduced bends in the spine.
+ point+=anchored;
+ tangent+=anchorSlope;
+ point.xy+=viewShift*point.z*.035;
+ tangent.xy+=viewShift*tangent.z*.035;
+ vec2 normal=normalize(vec2(-tangent.y,tangent.x));
+ float core=max(.28,strandStyle.x*unit*.65)*(1.+.18*highlight);
+ float halfWidth=core+max(.9,2.5*unit);
+ point.xy+=normal*pathStyle.y*halfWidth;
+ travel=pathStyle;strand=strandStyle;motion=flowStyle;painted=binding.w;shape=vec2(core,halfWidth);along=fraction.xy;
+ // Fade interleaved strands before their spacing falls below a pixel.
+ // Keeping all 17 at low DPR produced diagonal moire between filaments.
+ float gap=fraction.z*unit*pixelRatio;
+ filamentOpacity=1.;
+ if(mod(binding.z,2.)>.5)filamentOpacity*=smoothstep(1.,1.6,gap);
+ if(mod(binding.z,4.)>1.5)filamentOpacity*=smoothstep(1.,1.6,gap*2.);
+ if(mod(binding.z,8.)>3.5)filamentOpacity*=smoothstep(1.,1.6,gap*4.);
+ if(binding.w>.5||strandStyle.w>1.)filamentOpacity=1.;
+ gl_Position=projectionMatrix*viewMatrix*vec4(point,1.);
+ }`,
+ fragmentShader:`
+ uniform float time,unit,selectionActive;
+ uniform vec3 teal,pearl,glow,blush;
+ varying vec4 travel,strand,motion;
+ varying vec2 shape,along;
+ varying float highlight,filamentOpacity,painted;
+ void main(){
+ float across=abs(travel.y)*shape.y;
+ // Differentiate the signed ribbon coordinate before taking abs. Across
+ // the centreline, abs cancels neighbouring pixel derivatives and turns
+ // thin filaments into diagonal, braided-looking antialiasing bands.
+ float aa=max(fwidth(travel.y)*shape.y,.35);
+ float signedAcross=travel.y*shape.y;
+ float core=clamp((signedAcross+shape.x)/aa+.5,0.,1.)
+ -clamp((signedAcross-shape.x)/aa+.5,0.,1.);
+ float halo=exp(-across*across/max(shape.y*shape.y*.32,.01));
+ halo*=1.-smoothstep(.75,1.,abs(travel.y));
+ // A compact leading glint with a length-scaled filament tail. Speed is
+ // in art-space distance, with a seeded cadence for each bundle.
+ float cycle=strand.z+motion.y;
+ float progress=(mod(time*motion.x+travel.w*cycle,cycle)-150.)/strand.z;
+ float behind=progress*travel.z-travel.x;
+ float tailLength=motion.z;
+ float tail=smoothstep(-3.,2.,behind)*exp(-max(behind,0.)/tailLength)
+ *(1.-smoothstep(tailLength*2.,tailLength*3.2,behind));
+ float glint=exp(-pow(behind/motion.w,2.));
+ float pulse=strand.w*(tail+.65*glint);
+ float density=min(1.,unit/.55);
+ float brush=painted;
+ float notch=abs(along.x-(.18+.64*along.y));
+ float dry=smoothstep(.004,.014,notch);
+ float quiet=core*strand.y*(.95+.85*highlight)*mix(1.,.12+.88*dry,brush);
+ float light=pulse*(core*.90+halo*.38)*(1.+.25*highlight);
+ float ends=smoothstep(0.,.035,along.x)*smoothstep(0.,.035,1.-along.x);
+ float hoverHalo=halo*.09*highlight*brush;
+ float context=1.-.22*selectionActive*(1.-highlight);
+ float alpha=(quiet+light+hoverHalo)*density*ends*filamentOpacity*context;
+ // A continuous blue-green / pearl ground leaves the brightest white
+ // for the travelling edge filament, with no isolated pigment blocks.
+ vec3 ink=mix(teal,pearl,.18+.36*along.y);
+ ink=mix(ink,blush,smoothstep(.84,.97,along.y)*.55);
+ vec3 paint=mix(teal,pearl,.68+.06*sin(along.x*5.+along.y));
+ vec3 color=mix(ink,paint,brush);
+ color=mix(color,glow,min(.97,pulse*.72+.32*highlight));
+ gl_FragColor=vec4(color,min(alpha,.98));
+ #include
+ }`,
+ });
+ const mesh=new THREE.Mesh(geometry,material);
+ mesh.name='hero-flow-links';mesh.frustumCulled=false;mesh.renderOrder=-1;
+ const byName=new Map(targets.map(target=>[target.name,target]));
+ function attach(shift,target,point,scale){
+ if(!target){shift.set(0,0,0);return;}
+ target.sphere.getWorldPosition(shift);
+ shift.z-=target.sphere.scale.x*target.root.scale.x*.15;
+ shift.x-=(point[0]-781)*scale+mesh.position.x;
+ shift.y-=(567-point[1])*scale+mesh.position.y;
+ shift.z-=point[2]*scale;
+ }
+ return {
+ mesh,
+ update(time,width,height,pointer={x:0,y:0},pixelRatio=1){
+ // Composition box is explicit: no hidden legacy image owns layout.
+ const boxHeight=Math.round(height*.78751),boxWidth=Math.round(height*.78751*1562/1134);
+ const scale=boxWidth/1562;
+ uniforms.time.value=time;uniforms.unit.value=scale;uniforms.pixelRatio.value=pixelRatio;
+ uniforms.viewShift.value.set(pointer.x,pointer.y);
+ mesh.scale.setScalar(scale);
+ mesh.position.set(Math.round(width*.10545)+boxWidth/2-width/2,
+ height/2-Math.round(height*.07326)-boxHeight/2,0);
+ spines.forEach(({from,to,via=[],points},i)=>{
+ attach(uniforms.startShift.value[i],byName.get(from),points[0],scale);
+ attach(uniforms.endShift.value[i],byName.get(to),points[3],scale);
+ uniforms.routeEmphasis.value[i]=Math.max(...[from,...via,to].map(name=>
+ byName.get(name)?.material.uniforms.emphasis.value||0));
+ });
+ uniforms.selectionActive.value=Math.max(...uniforms.routeEmphasis.value);
+ },
+ dispose(){mesh.removeFromParent();geometry.dispose();material.dispose();},
+ };
+}
diff --git a/assets/home/50aa7b2c8191c024/javascripts/hero-hourglass.js b/assets/home/087f217bf2136799/javascripts/hero-hourglass.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/hero-hourglass.js
rename to assets/home/087f217bf2136799/javascripts/hero-hourglass.js
diff --git a/assets/home/50aa7b2c8191c024/javascripts/hero-paint-seams.js b/assets/home/087f217bf2136799/javascripts/hero-paint-seams.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/hero-paint-seams.js
rename to assets/home/087f217bf2136799/javascripts/hero-paint-seams.js
diff --git a/assets/home/50aa7b2c8191c024/javascripts/hero-planets.js b/assets/home/087f217bf2136799/javascripts/hero-planets.js
similarity index 77%
rename from assets/home/50aa7b2c8191c024/javascripts/hero-planets.js
rename to assets/home/087f217bf2136799/javascripts/hero-planets.js
index 853b4c5bf..0e5318796 100644
--- a/assets/home/50aa7b2c8191c024/javascripts/hero-planets.js
+++ b/assets/home/087f217bf2136799/javascripts/hero-planets.js
@@ -1,9 +1,18 @@
import * as THREE from "./vendor/three/three.module.min.js";
import { planets, createPlanet, loadPlanetPaint, disposePlanetPaint } from "./hero-surfaces.js";
+import { createFlowLinks } from "./hero-flow-links.js";
// The illustration supplies composition; each globe is independently lit and rotates fully.
export function createPlanets(map, items, onRestore, restoreImage = () => {}) {
const targets=planets.map(d=>({...d,item:items.find(i=>i.image.dataset.heroAsset === 'chapter_'+d.name)})).filter(d=>d.item);
+ // Stable pseudo-random handedness: each globe keeps its direction across
+ // reload, pause and resize, while neighbouring globes need not share it.
+ targets.forEach(target=>{
+ let hash=2166136261;
+ for(const char of target.name)hash=Math.imul(hash^char.charCodeAt(0),16777619);
+ hash=Math.imul(hash^(hash>>>16),0x85ebca6b);
+ target.spinDirection=((hash^(hash>>>13))>>>0)%2 ? 1 : -1;
+ });
const hero=map.closest('.home-div');
const renderer=new THREE.WebGLRenderer({alpha:true,antialias:true,powerPreference:'low-power'});
renderer.setClearColor(0x000000,0);renderer.domElement.className='hero-objects-canvas';
@@ -12,7 +21,7 @@ export function createPlanets(map, items, onRestore, restoreImage = () => {}) {
const scene=new THREE.Scene(),camera=new THREE.OrthographicCamera(-1,1,1,-1,.1,5000);
camera.position.z=2000;
map.insertBefore(renderer.domElement,map.querySelector(':scope > a'));
- let width=0,height=0,lost=false,disposed=false,ready=false,lastTime=0,startTime=null;
+ let width=0,height=0,lost=false,disposed=false,ready=false,lastTime=0,startTime=null,flowLinks=null;
const showOriginal=(show,load=false)=>{
if(load)targets.forEach(({item})=>restoreImage(item.image));
renderer.domElement.hidden=show;hero.classList.toggle('hero-three-active',!show);
@@ -24,6 +33,10 @@ export function createPlanets(map, items, onRestore, restoreImage = () => {}) {
renderer.setSize(Math.max(width,1),Math.max(height,1),false);
camera.left=-width/2;camera.right=width/2;camera.top=height/2;camera.bottom=-height/2;camera.updateProjectionMatrix();
for(const target of targets){const i=target.item.image;target.rect={x:i.offsetLeft,y:i.offsetTop,width:i.offsetWidth,height:i.offsetHeight};
+ const sourceHeight=Number(i.dataset.sourceHeight || i.naturalHeight);
+ const radius=(target.circle?.[2] || Math.min(Number(i.dataset.sourceWidth || i.naturalWidth),sourceHeight)/2);
+ // Use composition-relative globe size, excluding rings and viewport scale.
+ target.spinPeriod=18+720*(radius*target.rect.height/sourceHeight/Math.max(height,1));
}
}
function render(time,enabled,pointer={x:0,y:0}){
@@ -36,13 +49,15 @@ export function createPlanets(map, items, onRestore, restoreImage = () => {}) {
root.scale.setScalar(rect.height/Number(item.image.dataset.sourceHeight || item.image.naturalHeight));
root.position.set(rect.x+rect.width/2+item.x-width/2,height/2-rect.y-rect.height/2-item.y,0);
root.rotation.set(pointer.y*.035,pointer.x*.045,-item.angle*Math.PI/180);
- sphere.rotation.y=(time-startTime)*Math.PI*2/target.period;
+ sphere.rotation.y=(time-startTime)*Math.PI*2/target.spinPeriod*target.spinDirection;
if(target.moon)target.moon.rotation.y=sphere.rotation.y*2;
material.uniforms.emphasis.value+=((selected?1:0)-material.uniforms.emphasis.value)*emphasisBlend;
}
+ scene.updateMatrixWorld(true);
+ flowLinks?.update(time,width,height,pointer,renderer.getPixelRatio());
renderer.render(scene,camera);showOriginal(false);
Object.assign(renderer.domElement.dataset,{drawCalls:String(renderer.info.render.calls),triangles:String(renderer.info.render.triangles),
- art:'reference-authored-albedo',network:'original-brushwork',rotation:'continuous-360'});
+ art:'reference-authored-albedo',network:'three-brush-strands',rotation:'continuous-360'});
}
const onLost=event=>{event.preventDefault();lost=true;showOriginal(true,true);};
const onRestored=()=>{lost=false;resize();onRestore();};
@@ -52,10 +67,12 @@ export function createPlanets(map, items, onRestore, restoreImage = () => {}) {
const failure=results.find(r=>r.status==='rejected');if(failure)throw failure.reason;
if(disposed)return;
for(const target of targets){Object.assign(target,createPlanet(target.item.image,target,target.paintMap));scene.add(target.root);}
+ flowLinks=createFlowLinks(targets);
+ if(flowLinks)scene.add(flowLinks.mesh);
ready=true;resize();onRestore();
}).catch(error=>{if(!disposed){targets.forEach(t=>{disposePlanetPaint(t.paintMap);t.paintMap=null;});showOriginal(true,true);console.warn('Original planets retained: paint unavailable.',error);}});
return {resize,render,ready:readyPromise,dispose(){
- disposed=true;showOriginal(true,true);
+ disposed=true;showOriginal(true,true);flowLinks?.dispose();flowLinks=null;
renderer.domElement.removeEventListener('webglcontextlost',onLost);renderer.domElement.removeEventListener('webglcontextrestored',onRestored);
const geometries=new Set(),materials=new Set();scene.traverse(o=>{if(o.geometry)geometries.add(o.geometry);if(o.material)materials.add(o.material);});
geometries.forEach(g=>g.dispose());materials.forEach(m=>m.dispose());targets.forEach(t=>disposePlanetPaint(t.paintMap));renderer.dispose();renderer.forceContextLoss();renderer.domElement.remove();
diff --git a/assets/home/50aa7b2c8191c024/javascripts/hero-surfaces.js b/assets/home/087f217bf2136799/javascripts/hero-surfaces.js
similarity index 91%
rename from assets/home/50aa7b2c8191c024/javascripts/hero-surfaces.js
rename to assets/home/087f217bf2136799/javascripts/hero-surfaces.js
index e3bc10832..ad76f6935 100644
--- a/assets/home/50aa7b2c8191c024/javascripts/hero-surfaces.js
+++ b/assets/home/087f217bf2136799/javascripts/hero-surfaces.js
@@ -17,7 +17,7 @@ export const planets = [
{name:'graph',period:89,tilt:0.27,beltLevel:0.5,belt:[0.5,0.535,0.61,0.58,0.54,0.5,0.47,0.485,0.5],colors:['#464464','#786587','#be8d9d','#e3a493','#f2ce9b'],circle:[270,136,135],ring:[270,136,280,9,146],ringStyle:1},
{name:'searching',period:58,tilt:0.12,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#4b526d','#a7788a','#63a5a0','#a6b28c','#eddb9e']},
{name:'sorting',period:52,tilt:-0.5,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#3e3d57','#b57191','#eaa9ae','#f6df98','#fff0b5']},
- {name:'divide_and_conquer',period:94,tilt:0.58,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#494a63','#b6777e','#e5a129','#f3c45c','#ffe6a1'],circle:[156,130,117],ring:[203,134,240,60,164],ringStyle:2,moon:[307,50,33]},
+ {name:'divide_and_conquer',period:94,tilt:0.58,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#494a63','#b6777e','#e5a129','#f3c45c','#ffe6a1'],circle:[156,130,117],ring:[203,134,224,62,152],ringStyle:2,moon:[307,50,33]},
{name:'backtracking',period:81,tilt:-0.08,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#36475c','#727887','#eead30','#c58c4d','#f7d27b'],circle:[166,115,115],ring:[173,159,173,70,126],ringStyle:3},
{name:'dynamic_programming',period:67,tilt:0.2,beltLevel:0.5,belt:[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],colors:['#36394f','#8c4b6d','#d36959','#ed9d46','#f5cb6e']},
{name:'greedy',period:72,tilt:-0.57,beltLevel:0.5,belt:[0.5,0.4825,0.51,0.62,0.67,0.67,0.61,0.51,0.5],colors:['#234c60','#32878d','#72b1a7','#b9bd84','#e8ba66'],circle:[135,85,83],ring:[133,101,149,61,111],ringStyle:4},
@@ -134,7 +134,7 @@ export function createPlanet(image,d,paint) {
if(d.ring){
const [,y,outer,,inner]=d.ring;
ring=new T.Mesh(new T.RingGeometry(inner,outer,256),new T.ShaderMaterial({side:T.DoubleSide,transparent:true,depthWrite:false,
- uniforms:{inner:{value:inner},outer:{value:outer},style:{value:d.ringStyle},ink:{value:new T.Color(d.ringStyle===2?'#c3d3a7':d.ringStyle===4?'#66bcb3':d.ringStyle===3?'#f5b632':d.colors[d.ringStyle===1?2:4])},dark:{value:new T.Color(d.ringStyle===0?'#bca178':d.ringStyle===2?'#986e63':d.ringStyle===4?'#e5b66a':d.ringStyle===3?'#686c80':d.colors[1])}},vertexShader:vertex,
+ uniforms:{inner:{value:inner},outer:{value:outer},style:{value:d.ringStyle},ink:{value:new T.Color(d.ringStyle===0?'#c4b797':d.ringStyle===2?'#c3d3a7':d.ringStyle===4?'#66bcb3':d.ringStyle===3?'#f5b632':d.colors[d.ringStyle===1?2:4])},dark:{value:new T.Color(d.ringStyle===0?'#aa987b':d.ringStyle===2?'#b9c9a5':d.ringStyle===4?'#e5b66a':d.ringStyle===3?'#686c80':d.colors[1])}},vertexShader:vertex,
fragmentShader:`varying vec3 p;uniform float inner;uniform float outer;uniform float style;uniform vec3 ink;uniform vec3 dark;
// Integrate a stroke over its pixel footprint. Unresolved rings become faint
// continuous coverage, rather than hard discard dots that shimmer in motion.
@@ -145,7 +145,7 @@ export function createPlanet(image,d,paint) {
float pixel=max(fwidth(t),.0005);float alpha=1.;
vec3 color=ink;
if(style==0.){
- // Broad cream ring: a small number of painterly layers, not a sine comb.
+ // Muted sand ring: preserve painted layers without overpowering the globe.
color=mix(ink,dark,.22*stroke(t,.18,.06,pixel));
color=mix(color,dark,.18*stroke(t,.45,.025,pixel));
color=mix(color,dark,.12*stroke(t,.66,.04,pixel));
@@ -154,8 +154,17 @@ export function createPlanet(image,d,paint) {
}else if(style==1.){
color=mix(dark,ink,.45+.35*smoothstep(.15,.85,t));
}else if(style==2.){
- float first=stroke(t,.12,.027,pixel),middle=stroke(t,.46,.020,pixel),last=stroke(t,.86,.024,pixel);
- alpha=max(first,max(middle,last));color=mix(ink,dark,.35*last);
+ // A painted main sweep with tapered companion arcs, rather than
+ // three equally weighted wire hoops. A single soft sage pigment
+ // keeps the ring coherent; the shared lighting supplies depth.
+ float a=atan(p.y,p.x),sage=smoothstep(-.35,.65,cos(a-.2));
+ float sweep=.55+.45*smoothstep(-.98,-.55,cos(a+.7));
+ float main=stroke(t,.46+.025*sin(a+.35),(.025+.065*sage)*sweep,pixel);
+ float inside=stroke(t,.12+.018*sin(a),.018+.023*sage,pixel);
+ float taper=smoothstep(-.85,-.3,cos(a-.6));
+ float outside=stroke(t,.87+.016*cos(a),(.012+.020*sage)*taper,pixel);
+ alpha=max(main,max(inside*.78,outside*.62));
+ color=ink;
}else{
// Individually drawn, tapered sweeps. The radial curves stay in the
// equatorial plane; angular variation gives the original ink character.
diff --git a/assets/home/50aa7b2c8191c024/javascripts/homepage-media.js b/assets/home/087f217bf2136799/javascripts/homepage-media.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/homepage-media.js
rename to assets/home/087f217bf2136799/javascripts/homepage-media.js
diff --git a/assets/home/50aa7b2c8191c024/javascripts/starfield.js b/assets/home/087f217bf2136799/javascripts/starfield.js
similarity index 84%
rename from assets/home/50aa7b2c8191c024/javascripts/starfield.js
rename to assets/home/087f217bf2136799/javascripts/starfield.js
index 176dad4a8..3a4bcd549 100644
--- a/assets/home/50aa7b2c8191c024/javascripts/starfield.js
+++ b/assets/home/087f217bf2136799/javascripts/starfield.js
@@ -39,9 +39,7 @@
angle: 0,
})).filter(item => item.image);
const ground = map.querySelector(':scope > img[data-hero-asset="ground"]');
- const links = map.querySelector(':scope > img[data-hero-asset="links"]');
ground?.classList.add("hero-ground");
- links?.classList.add("hero-links");
hero.classList.add("hero-universe");
const canvas = document.createElement("canvas");
@@ -119,21 +117,25 @@
if (!ctx) return;
ctx.clearRect(0, 0, width, height);
for (const star of stars) {
- const drift = time * star.depth * 0.7;
- const x = wrap(star.x * width + drift + pointer.x * star.depth * 10, width + 16) - 8;
- const y = wrap(star.y * height + Math.sin(time * 0.08 + star.phase) * 2 + pointer.y * star.depth * 7, height + 16) - 8;
- const twinkle = 0.78 + Math.sin(time * star.speed + star.phase) * 0.22;
+ const drift = time * star.depth * 0.35;
+ const x = wrap(star.x * width + drift + pointer.x * star.depth * 10 + 8, width + 16) - 8;
+ const y = wrap(star.y * height + Math.sin(time * 0.08 + star.phase) * star.depth * 2 + pointer.y * star.depth * 7 + 8, height + 16) - 8;
+ const twinkle = 1 - star.breath * (0.5 + 0.5 * Math.sin(time * star.speed + star.phase));
ctx.globalAlpha = star.opacity * twinkle;
+ // Only the few near stars get a tight, soft halo; the core stays sharp.
+ if (star.layer === 2) {
+ const radius = star.radius * 2.2;
+ const halo = ctx.createRadialGradient(x, y, 0, x, y, radius);
+ halo.addColorStop(0, star.color + "24");
+ halo.addColorStop(0.45, star.color + "0c");
+ halo.addColorStop(1, star.color + "00");
+ ctx.fillStyle = halo;
+ ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
+ }
ctx.fillStyle = star.color;
ctx.beginPath();
ctx.arc(x, y, star.radius, 0, Math.PI * 2);
ctx.fill();
- if (star.radius > 1.2) {
- ctx.globalAlpha *= 0.12;
- ctx.beginPath();
- ctx.arc(x, y, star.radius * 3, 0, Math.PI * 2);
- ctx.fill();
- }
}
ctx.globalAlpha = 1;
}
@@ -221,7 +223,7 @@
width = Math.max(container.clientWidth, 1);
height = Math.max(container.clientHeight, 1);
scale = Math.min(1, map.clientWidth / 1000);
- const dpr = Math.min(window.devicePixelRatio || 1, finePointer.matches ? 1.5 : 1);
+ const dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = Math.round(width * dpr);
canvas.height = Math.round(height * dpr);
ctx?.setTransform(dpr, 0, 0, dpr, 0, 0);
@@ -229,14 +231,41 @@
let seed = 73;
const random = () => { seed = (seed * 1664525 + 1013904223) >>> 0; return seed / 4294967296; };
const count = Math.min(finePointer.matches ? 300 : 130, Math.max(65, Math.round(width * height / 4200)));
- stars = Array.from({ length: count }, (_, i) => ({
- x: random(), y: random(), phase: random() * Math.PI * 2,
- depth: [0.25, 0.6, 1][i % 3],
- radius: (0.4 + random() * 0.55) * [0.7, 1, 1.5][i % 3],
- opacity: 0.2 + random() * 0.45,
- speed: 0.35 + random() * 0.45,
- color: ["#d0dedc", "#c5d2e8", "#e3d5bf"][i % 3],
- }));
+ // Loose off-centre clusters alternate with open sky. Keep the same
+ // seeded sequence across viewports, and leave the central artwork quiet.
+ const clusters = [[.12,.32,.10,.14],[.86,.23,.11,.10],[.82,.76,.11,.12],[.24,.79,.12,.10]];
+ const colors = [
+ ["#a4b9bf", "#aabbd0", "#c2bcac"],
+ ["#bdd4d7", "#b7cbe3", "#d6cdb7"],
+ ["#e0edec", "#d7e6fa", "#e9dfc5"],
+ ];
+ // Add about 30% more distant pinpoints while preserving all existing
+ // mid/near stars and their positions; concentrate the additions loosely.
+ const extraFar = Math.round(count * .72 * .30);
+ stars = Array.from({ length: count + extraFar }, (_, index) => {
+ const extra = index >= count;
+ let x = random(), y = random();
+ if (random() < (extra ? .65 : .38)) {
+ const [cx,cy,sx,sy] = clusters[Math.floor(random() * clusters.length)];
+ const radius = Math.sqrt(-2 * Math.log(Math.max(random(), .0001)));
+ const angle = random() * Math.PI * 2;
+ x = wrap(cx + Math.cos(angle) * radius * sx, 1);
+ y = wrap(cy + Math.sin(angle) * radius * sy, 1);
+ }
+ const choice = random(), layer = extra || choice < .72 ? 0 : choice < .945 ? 1 : 2;
+ const central = Math.exp(-(((x-.5)/.24)**2 + ((y-.46)/.31)**2));
+ const title = Math.exp(-(((x-.5)/.22)**2 + ((y-.86)/.12)**2));
+ const quiet = 1 - .35 * central - .25 * title;
+ return {
+ x, y, layer, phase: random() * Math.PI * 2,
+ depth: [.14,.44,.86][layer] + random() * .10,
+ radius: [.34,.57,1.0][layer] + random() * [.22,.30,.28][layer],
+ opacity: ([.30,.30,.56][layer] + random() * [.20,.20,.17][layer]) * quiet,
+ breath: [.05,.10,.14][layer],
+ speed: .12 + random() * .16,
+ color: colors[layer][Math.floor(random() * 3)],
+ };
+ });
if (!paused || reduced.matches) moveIllustrations(0);
drawStars();
planets?.resize();
@@ -260,7 +289,6 @@
function updateSelection() {
const selected = focused || hovered;
for (const item of items) item.anchor.classList.toggle("hero-selected", item.anchor === selected);
- map.classList.toggle("hero-network-active", Boolean(selected));
if (!canRun()) renderObjects();
}
@@ -314,11 +342,9 @@
canvas.remove();
toggle.remove();
hero.classList.remove("hero-universe", "hero-motion-paused");
- map.classList.remove("hero-network-active");
map.style.removeProperty("--hero-ground-x");
map.style.removeProperty("--hero-ground-y");
ground?.classList.remove("hero-ground");
- links?.classList.remove("hero-links");
for (const { anchor, label, originalLabelMargin } of items) {
if (label) label.style.marginLeft = originalLabelMargin;
anchor.classList.remove("hero-selected");
diff --git a/assets/home/50aa7b2c8191c024/javascripts/vendor/three/three.core.min.js b/assets/home/087f217bf2136799/javascripts/vendor/three/three.core.min.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/vendor/three/three.core.min.js
rename to assets/home/087f217bf2136799/javascripts/vendor/three/three.core.min.js
diff --git a/assets/home/50aa7b2c8191c024/javascripts/vendor/three/three.module.min.js b/assets/home/087f217bf2136799/javascripts/vendor/three/three.module.min.js
similarity index 100%
rename from assets/home/50aa7b2c8191c024/javascripts/vendor/three/three.module.min.js
rename to assets/home/087f217bf2136799/javascripts/vendor/three/three.module.min.js
diff --git a/assets/home/50aa7b2c8191c024/manifest.json b/assets/home/087f217bf2136799/manifest.json
similarity index 97%
rename from assets/home/50aa7b2c8191c024/manifest.json
rename to assets/home/087f217bf2136799/manifest.json
index 03eb8f02c..930b66eb2 100644
--- a/assets/home/50aa7b2c8191c024/manifest.json
+++ b/assets/home/087f217bf2136799/manifest.json
@@ -1,5 +1,5 @@
{
- "version": "50aa7b2c8191c024",
+ "version": "087f217bf2136799",
"assets": {
"ground": {
"width": 881,
@@ -8,13 +8,6 @@
"kind": "hero",
"path": "../shared/images/567306c070a6a7e2/ground.webp"
},
- "links": {
- "width": 1562,
- "height": 1134,
- "loading": "visible-layout",
- "kind": "hero",
- "path": "../shared/images/3e50f38a325c1cb5/links.webp"
- },
"astronaut": {
"width": 515,
"height": 672,
@@ -297,12 +290,6 @@
"href": null,
"label_style": null
},
- {
- "id": "links",
- "style": "position: absolute; width: auto; height: 78.751%; left: 10.545%; top: 7.326%;",
- "href": null,
- "label_style": null
- },
{
"id": "astronaut",
"style": "height: 46.673%; left: 35.413%; top: 24.343%;",
@@ -410,7 +397,6 @@
"shared/images/2ce6caaac951c40b/chapter_greedy.webp",
"shared/images/2fb425426d1f8d86/chapter_computational_complexity.webp",
"shared/images/325eedad7e336423/en_animation-poster.webp",
- "shared/images/3e50f38a325c1cb5/links.webp",
"shared/images/464e2d351b9263ec/avatar_gvenusleo.webp",
"shared/images/567306c070a6a7e2/ground.webp",
"shared/images/5b64cf7672ec5ec6/web_mac_iphone.webp",
diff --git a/assets/home/shared/images/3e50f38a325c1cb5/links.webp b/assets/home/shared/images/3e50f38a325c1cb5/links.webp
deleted file mode 100644
index 8c529e142..000000000
Binary files a/assets/home/shared/images/3e50f38a325c1cb5/links.webp and /dev/null differ
diff --git a/en/assets/covers/chapter_hello_algo.svg b/en/assets/covers/chapter_hello_algo.svg
index 56ea9b13b..2babd9d53 100644
--- a/en/assets/covers/chapter_hello_algo.svg
+++ b/en/assets/covers/chapter_hello_algo.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/en/index.html b/en/index.html
index fe13505df..27cc1a89a 100644
--- a/en/index.html
+++ b/en/index.html
@@ -152,7 +152,7 @@
-
+