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

82 lines
6.8 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['pharma-batch-genealogy'] = function(svg,config,kit){
const s=scene(svg,config,kit,"Batch genealogy: hold, then release","A quality hold propagates to descendants; disposition restores only the accepted branch.",["Trace inputs", "Blend batch", "Hold lineage", "Review evidence", "Release branch"]);
const {text,path,rect,circle,show,flow,note,c}=s;
function drum(x,y,label){rect(x,y,94,72,'#18314a',c.blue,12);path(`M${x} ${y+16} H${x+94} M${x} ${y+56} H${x+94}`,c.line,2);text(x+10,y+42,label,18);}
drum(40,123,'Lot A');drum(40,256,'Lot B');
path('M134 159 H220 V215 H290 M134 292 H220 V215');
rect(290,151,150,140,'#1b3044',c.blue,35);path('M365 125 V247 M335 234 L395 256 M335 256 L395 234',c.blue,4);text(309,324,'Blend batch',18);
flow('M134 159 H220 V215 H290',0,c.blue);flow('M134 292 H220 V215 H290',0,c.blue);
path('M440 215 H510 V155 H577 M510 215 V300 H577');flow('M440 215 H510 V155 H577 M510 215 V300 H577',1,c.blue);
function pack(y,label){rect(577,y,100,72,'#18314a',c.blue);path(`M602 ${y} V${y+72}`,c.line,2);text(614,y+42,label,18);}
pack(119,'P1');pack(264,'P2');
show(rect(555,103,145,105,'none',c.amber),2);show(rect(555,249,145,105,'none',c.amber),2);
text(704,131,'P1 · evidence accepted',16,c.green);text(717,288,'P2 · hold retained',16,c.amber);
flow('M677 155 H885',4,c.green);show(circle(889,155,8,c.green),4);
note(274,366,350,'Disposition follows evidence','Not every descendant is released',c.green,4);
note(39,366,218,'Quality review','Trace the affected lots',c.amber,3);
const count=Math.max(2,Math.min(5,Math.round(Number(config.packCount)||3)));
const packs=[];
for(let i=0;i<count;i++){const n=rect(727+i*31,185,19,33,'#254a50',c.green,3);packs.push(n);}
s.tl.add(packs,{y:[165,185],opacity:[.15,1],delay:kit.anime.stagger(s.p*.075),duration:s.p*.5},4*s.p);
const sample=circle(365,215,7,c.ink);s.move(sample,365,215,531,215,1);
const paddle=path('M348 267 H382',c.blue,4);paddle.style.transformBox='fill-box';paddle.style.transformOrigin='center';s.tl.add(paddle,{rotate:[0,180],duration:s.p*.8},s.p);
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
};
window.industryRenderers['pharma-cold-chain-quarantine'] = function(svg,config,kit){
const s=scene(svg,config,kit,"Cold chain: excursion to quarantine","A recorded excursion changes custody status, not the historical temperature trace.",["Pack & record", "Transport", "Excursion", "Quarantine", "Disposition"]);
const {text,path,rect,circle,show,flow,note,c}=s;
rect(38,128,160,130,'#18314a',c.blue);path('M55 145 H181 V240 H55 Z M118 145 V240',c.blue,2);text(56,284,'Origin storage',18);
rect(306,172,180,78,'#18314a',c.blue);path('M486 195 H535 L559 223 V250 H486 Z',c.blue,3);circle(347,255,17,c.muted);circle(516,255,17,c.muted);text(340,288,'Transit logger',18);
rect(714,127,190,131,'#18314a',c.amber);path('M714 127 L809 105 L904 127 M737 146 V241 M765 146 V241 M793 146 V241 M821 146 V241 M849 146 V241 M877 146 V241',c.line,2);text(731,284,'Quarantine bay',18,c.amber);
flow('M198 211 H306',0,c.blue);flow('M559 211 H714',3,c.amber);
text(39,330,'Recorded condition',18);rect(40,347,512,68,'#152f35','#264c50');text(565,419,'Illustrative acceptance band',16,c.muted);
path('M40 426 H552 M40 343 V426',c.muted,1);
flow('M43 382 L120 380 L194 386 L268 376',1,c.blue);
flow('M268 376 L325 351 L369 325 L411 330 L454 375 L548 383',2,c.red);
text(304,316,'Excursion',16,c.red);
note(662,332,260,'Evidence → disposition','Return / release / reject',c.green,4);
show(circle(809,192,17,c.amber),3);text(37,448,'No thresholds, stability claims or product-release rules are encoded.',16,c.muted);
const rise=Math.max(18,Math.min(58,Number(config.excursionRise)||48));
rect(602,115,18,85,'#1c344b',c.muted,9);circle(611,203,15,c.red);
const mercury=rect(607,172,8,28,c.red,c.red,3);
s.tl.add(mercury,{height:[28,28+rise],y:[172,172-rise],duration:s.p*.7},2*s.p);
const payload=rect(139,202,34,28,'#37556a',c.blue,2);
s.tl.add(payload,{x:[139,409],y:[202,207],duration:s.p*.75},s.p);
s.tl.add(payload,{x:[409,409],y:[207,207],duration:s.p*1.25},s.p*1.75);
s.tl.add(payload,{x:[409,758],y:[207,212],duration:s.p*.75},3*s.p);
const latch=path('M787 167 H831',c.amber,5);latch.style.transformBox='fill-box';latch.style.transformOrigin='center';s.tl.add(latch,{rotate:[90,0],duration:s.p*.5},3*s.p);
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
};
})();