Files
presentation-html/assets/animejs/industries/government.js
T

67 lines
6.3 KiB
JavaScript

/* Original conceptual industry scenes; Anime.js v4. */
(function(){
window.industryRenderers ??= {};
function scene(svg, config, kit, title, subtitle, phases) {
const {el,anime}=kit, p=Number.isFinite(Number(config.phaseMs)) && Number(config.phaseMs)>0 ? Number(config.phaseMs) : 1200;
const c={ink:'#e5edf7',muted:'#93a8bf',blue:'#63baff',green:'#6ce1b4',amber:'#ffc56b',red:'#ff8091',bg:'#101e30',line:'#314961'};
const E=(tag,a={},t='',parent=svg)=>el(tag,a,t,parent);
const text=(x,y,t,size=18,color=c.ink)=>E('text',{x,y,fill:color,'font-size':size,'font-family':'system-ui'},t);
const path=(d,color=c.line,w=5)=>E('path',{d,fill:'none',stroke:color,'stroke-width':w,'stroke-linecap':'round','stroke-linejoin':'round'});
const rect=(x,y,w,h,color=c.bg,stroke=c.line,rx=8)=>E('rect',{x,y,width:w,height:h,rx,fill:color,stroke,'stroke-width':2});
const circle=(x,y,r,color=c.blue)=>E('circle',{cx:x,cy:y,r,fill:color});
E('rect',{width:960,height:540,fill:'#091321'});
text(32,38,title,26);text(32,67,subtitle,16,c.muted);
path('M32 88 H928',c.line,1);
const tl=anime.createTimeline({autoplay:false,defaults:{ease:'linear'}});
const anchor=E('g');tl.add(anchor,{opacity:[1,1],duration:p*5},0);
function show(node,step){node.setAttribute('opacity','.15');tl.add(node,{opacity:[.15,1],duration:p*.65},step*p);return node;}
function flow(d,step,color=c.green){const n=path(d,color,5);const len=n.getTotalLength();n.setAttribute('stroke-dasharray',len);n.setAttribute('stroke-dashoffset',len);tl.add(n,{'stroke-dashoffset':[len,0],duration:p*.75},step*p);return n;}
function move(n,x0,y0,x1,y1,step){tl.add(n,{cx:[x0,x1],cy:[y0,y1],duration:p*.75},step*p);}
function note(x,y,w,heading,detail,color=c.green,step=0){rect(x,y,w,58);show(rect(x,y,5,58,color,color,0),step);text(x+16,y+24,heading,18,color);text(x+16,y+46,detail,16,c.muted);}
function valve(x,y,step){const n=path(`M${x-10} ${y-10} L${x+10} ${y+10} M${x+10} ${y-10} L${x-10} ${y+10}`,c.red,4);show(n,step);}
phases.forEach((s,i)=>{const x=32+i*182;rect(x,465,174,42,'#132338');show(rect(x,465,4,42,c.blue,c.blue,0),i);text(x+12,491,`${i+1} ${s}`,16);});
text(32,529,'Conceptual sequence · illustrative timing · not an operating procedure',16,c.muted);
return {E,text,path,rect,circle,tl,show,flow,move,note,valve,c,p};
}
window.industryRenderers['government-permit-review-loop'] = function(svg,config,kit){
const s=scene(svg,config,kit,"Permit review: parallel checks & correction","Independent reviews converge; a missing exhibit returns to the applicant before decision.",["Application", "Parallel review", "Missing exhibit", "Correction", "Decision gate"]);
const {text,path,rect,circle,show,flow,note,c}=s;
rect(40,177,114,142,'#18314a',c.blue);path('M61 205 H129 M61 227 H129 M61 249 H111',c.muted,3);text(36,348,'Application',18);
const ys=[139,248,357];['Land use','Safety review','Public input'].forEach((a,i)=>{circle(421,ys[i],36,'#18314a');const check=path(`M405 ${ys[i]} L416 ${ys[i]+11} L438 ${ys[i]-12}`,i===1?c.amber:c.green,3);if(i===1)s.tl.add(check,{stroke:[c.amber,c.green],duration:s.p*.65},3*s.p);text(473,ys[i]-18,a,18);path(`M154 248 H268 V${ys[i]} H385`);flow(`M154 248 H268 V${ys[i]} H385`,1,c.blue);});
show(circle(97,288,9,c.blue),0);
path('M457 139 H685 V248 M457 357 H685 V248 M457 248 H685',c.line,3);
flow('M421 284 V409 H214 V318',2,c.amber);text(245,438,'Correction loop · missing exhibit',17,c.amber);
flow('M214 318 V96 H421 V103',3,c.green);text(228,120,'Evidence resubmitted',16,c.green);
path('M685 248 L723 210 L761 248 L723 286 Z',c.blue,3);text(766,253,'Decision',18);
flow('M629 139 H685 V248 H723',4,c.green);flow('M629 357 H685 V248 H723',4,c.green);flow('M629 248 H723',4,c.green);
note(727,335,198,'Gate, not a promise','Local rules vary',c.green,4);
const sheets=Math.max(1,Math.min(4,Math.round(Number(config.exhibitPages)||3)));
for(let i=0;i<sheets;i++){const n=rect(64+i*7,267+i*4,28,34,'#3b5268',c.blue,1);s.tl.add(n,{x:[64+i*7,312+i*7],y:[267+i*4,385+i*4],duration:s.p*.65},2*s.p);s.tl.add(n,{x:[312+i*7,312+i*7],y:[385+i*4,385+i*4],duration:s.p*.35},2.65*s.p);s.tl.add(n,{x:[312+i*7,340+i*7],y:[385+i*4,221+i*4],duration:s.p*.65},3*s.p);}
const stamp=rect(701,228,44,40,'none',c.green,4);s.tl.add(stamp,{opacity:[0,1],y:[211,228],duration:s.p*.6},4*s.p);
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
};
window.industryRenderers['government-budget-execution'] = function(svg,config,kit){
const s=scene(svg,config,kit,"Budget allocation: authority before spend","Approved envelopes become commitments; expenditure follows a separate execution gate.",["Allocate", "Authorize", "Commit", "Verify delivery", "Record spend"]);
const {text,path,rect,circle,show,flow,note,c}=s;
path('M40 163 L138 113 L236 163 Z M43 266 H233 M53 277 H223',c.blue,4);
[64,111,158,205].forEach(x=>{rect(x,173,15,80,'#24435c',c.blue,1);});text(49,307,'Public envelope',18);
const rows=[149,258,367];const names=['Mobility','Community','Environment'];
rows.forEach((y,i)=>{path(`M236 215 H288 V${y} H336`);text(338,y-20,names[i],18);rect(336,y-7,186,26,'#18314a',c.line,2);const n=rect(336,y-7,0,26,c.blue,c.blue,2);s.tl.add(n,{width:[0,[160,125,96][i]],duration:s.p*.7},0);path(`M522 ${y+6} H895`);});
text(554,111,'Authority',16,c.muted);text(667,111,'Commit',16,c.muted);text(791,111,'Spend',16,c.muted);
rows.forEach((y,i)=>{show(rect(566,y-10,30,30,c.green,c.green,3),1);show(circle(699,y+5,15,c.amber),2);flow(`M714 ${y+5} H805`,3,c.green);show(circle(830,y+5,15,c.green),4);});
note(36,351,237,'Unspent ≠ free cash','Envelopes retain purpose',c.amber,2);
text(338,431,'Bars are illustrative shares, not currency or real allocations.',16,c.muted);
const scale=Math.max(.5,Math.min(1,Number(config.allocationScale)||.85));
const lock=path('M573 141 V128 Q581 115 589 128 V141',c.amber,3);s.tl.add(lock,{opacity:[1,.15],duration:s.p*.6},s.p);
for(let i=0;i<3;i++){const token=circle(600,rows[i]+5,6,c.ink);s.move(token,600,rows[i]+5,830,rows[i]+5,3);}
const ledger=rect(788,395,100,12,'#20394c',c.line,1);const posted=rect(788,395,0,12,c.green,'none',1);s.tl.add(posted,{width:[0,100*scale],duration:s.p*.7},4*s.p);
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
};
})();