fix(airport): draw apron fans as solid wedges with a gap, not a fade
This commit is contained in:
+13
-8
@@ -241,8 +241,8 @@ function clipToHull(points,poly){
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
function apronSector(hull,side,outerR,steps=12){
|
function apronSector(hull,side,outerR,steps=16,inset=.035){
|
||||||
const a0=-Math.PI/2+side*Math.PI/3,a1=a0+Math.PI/3,pts=[];
|
const a0=-Math.PI/2+side*Math.PI/3+inset,a1=-Math.PI/2+(side+1)*Math.PI/3-inset,pts=[];
|
||||||
for(let i=0;i<=steps;i++){
|
for(let i=0;i<=steps;i++){
|
||||||
const a=a0+(a1-a0)*i/steps,dir={x:Math.cos(a),y:Math.sin(a)};
|
const a=a0+(a1-a0)*i/steps,dir={x:Math.cos(a),y:Math.sin(a)};
|
||||||
const t=rimCrossing(hull,{x:0,y:0},dir),r=(t??0)+.08;
|
const t=rimCrossing(hull,{x:0,y:0},dir),r=(t??0)+.08;
|
||||||
@@ -254,6 +254,16 @@ function apronSector(hull,side,outerR,steps=12){
|
|||||||
}
|
}
|
||||||
return pts;
|
return pts;
|
||||||
}
|
}
|
||||||
|
function rgba(hex,a){const n=hex.replace('#','');return `rgba(${parseInt(n.slice(0,2),16)},${parseInt(n.slice(2,4),16)},${parseInt(n.slice(4,6),16)},${a})`;}
|
||||||
|
function drawApronFans(hull,outerR){
|
||||||
|
const fill='#d1d1d1';
|
||||||
|
for(let side=0;side<6;side++){
|
||||||
|
polygon(apronSector(hull,side,outerR),rgba(fill,.2));
|
||||||
|
const inset=.035,a0=-Math.PI/2+side*Math.PI/3+inset,a1=-Math.PI/2+(side+1)*Math.PI/3-inset;
|
||||||
|
ctx.beginPath();ctx.arc(0,0,outerR,a0,a1);
|
||||||
|
ctx.strokeStyle=rgba(fill,.16);ctx.lineWidth=.055;ctx.lineCap='round';ctx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
function aircraft(plane,where,alpha=1){
|
function aircraft(plane,where,alpha=1){
|
||||||
ctx.save();ctx.translate(where.x,where.y);ctx.globalAlpha=alpha;
|
ctx.save();ctx.translate(where.x,where.y);ctx.globalAlpha=alpha;
|
||||||
const color=pigments[plane.color].color;
|
const color=pigments[plane.color].color;
|
||||||
@@ -281,12 +291,7 @@ function draw(now){
|
|||||||
const radius=boardRadius(game.level.cells),apronR=apronDistance(radius);
|
const radius=boardRadius(game.level.cells),apronR=apronDistance(radius);
|
||||||
const stacks=Math.max(1,...[0,1,2,3,4,5].map(s=>game.level.arrivals.filter(a=>a.side===s).length));
|
const stacks=Math.max(1,...[0,1,2,3,4,5].map(s=>game.level.arrivals.filter(a=>a.side===s).length));
|
||||||
const outerR=apronR+(stacks-1)*1.12+.85;
|
const outerR=apronR+(stacks-1)*1.12+.85;
|
||||||
for(let side=0;side<6;side++)polygon(apronSector(hullPts,side,outerR),materials.shadowSoft);
|
drawApronFans(hullPts,outerR);
|
||||||
for(let side=0;side<6;side++){
|
|
||||||
const a=-Math.PI/2+side*Math.PI/3,dir={x:Math.cos(a),y:Math.sin(a)};
|
|
||||||
const t=rimCrossing(hullPts,{x:0,y:0},dir),inner=(t??0)+.08;
|
|
||||||
line([{x:dir.x*inner,y:dir.y*inner},{x:dir.x*outerR,y:dir.y*outerR}],materials.shadow,.045);
|
|
||||||
}
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
if(rotation){const p=Math.min(1,(now-rotation.start)/rotation.duration),u=p*p*(3-2*p);ctx.rotate(rotation.direction*Math.PI/3*u);}
|
if(rotation){const p=Math.min(1,(now-rotation.start)/rotation.duration),u=p*p*(3-2*p);ctx.rotate(rotation.direction*Math.PI/3*u);}
|
||||||
const tray=grow=>roundedPoly(hull(board.cells.flatMap(c=>{const p=position(c.q,c.r);return hexPoints(p.x,p.y,TRAY_PAD+grow);})),.9);
|
const tray=grow=>roundedPoly(hull(board.cells.flatMap(c=>{const p=position(c.q,c.r);return hexPoints(p.x,p.y,TRAY_PAD+grow);})),.9);
|
||||||
|
|||||||
Reference in New Issue
Block a user