73 lines
6.3 KiB
JavaScript
73 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['retail-inventory-reservation'] = function(svg,config,kit){
|
|
const s=scene(svg,config,kit,"Omnichannel: reserve before promising","Two demand channels compete for one pickable unit; the second order gets an honest alternative.",["Count stock", "Web reserves", "Store competes", "Offer alternate", "Fulfil promise"]);
|
|
|
|
const {text,path,rect,circle,show,flow,note,c}=s;
|
|
rect(40,131,148,97,'#18314a',c.blue);rect(51,143,126,66,'#0d2033',c.line);path('M114 228 V246 M83 246 H145',c.blue,3);text(51,276,'Web order A',18);
|
|
path('M42 355 H188 V417 H42 Z M35 355 L55 320 H175 L195 355',c.blue,3);[55,85,115,145,175].forEach(x=>path(`M${x} 327 V353`,c.amber,8));text(48,445,'Store order B',18);
|
|
rect(348,127,226,215,'#112539',c.blue,2);path('M348 199 H574 M348 271 H574 M423 127 V342 M499 127 V342',c.line,3);
|
|
rect(437,217,47,39,'none',c.line,1);text(365,368,'One pickable unit',18);show(rect(431,211,59,51,'none',c.green,2),0);
|
|
flow('M188 181 H289 V236 H431',1,c.green);text(208,161,'A reserves',16,c.green);
|
|
flow('M188 381 H289 V287 H336',2,c.amber);path('M322 277 L338 293 M338 277 L322 293',c.amber,3);text(199,414,'B cannot double-sell',16,c.amber);
|
|
rect(743,143,152,104,'#18314a',c.blue,3);path('M743 143 L819 112 L895 143 M819 143 V247',c.blue,2);text(750,277,'Pick & dispatch A',17);
|
|
flow('M484 236 H650 V195 H743',4,c.green);
|
|
note(646,331,276,'B: alternate location','Or explicit wait / cancel',c.amber,3);
|
|
|
|
const size=Math.max(22,Math.min(44,Number(config.parcelSize)||34));
|
|
const parcel=rect(444,222,size,size,'#294f66',c.green,2);
|
|
s.tl.add(parcel,{x:[444,827],y:[222,184],duration:s.p*.8},4*s.p);
|
|
const reserved=path('M443 219 V209 Q461 188 479 209 V219',c.green,3);s.show(reserved,1);
|
|
s.tl.add(reserved,{opacity:[1,1],duration:s.p*2.35},s.p*1.65);
|
|
s.tl.add(reserved,{opacity:[1,.15],duration:s.p*.5},4*s.p);
|
|
|
|
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
|
|
};
|
|
window.industryRenderers['retail-return-disposition'] = function(svg,config,kit){
|
|
const s=scene(svg,config,kit,"Returns: inspect before restocking","Refund and inventory disposition are separate branches; damaged goods stay out of sellable stock.",["Receive return", "Inspect condition", "Route disposition", "Refund record", "Restock accepted"]);
|
|
|
|
const {text,path,rect,circle,show,flow,note,c}=s;
|
|
path('M43 179 L108 154 L173 179 V251 L108 278 L43 251 Z M43 179 L108 206 L173 179 M108 206 V278',c.blue,3);text(44,311,'Returned parcel',18);
|
|
rect(293,194,164,15,'#29475f',c.blue,1);path('M307 209 V280 M442 209 V280',c.blue,5);circle(369,151,29,'none');path('M389 172 L413 197',c.amber,7);text(294,313,'Inspect & classify',18);
|
|
flow('M173 220 H293',0,c.blue);show(circle(369,151,22,c.amber),1);
|
|
path('M457 202 H533 V142 H643 M533 202 V278 H643');
|
|
rect(643,109,246,71,'#18314a',c.green,2);path('M658 144 H873 M725 110 V179 M805 110 V179',c.line,2);text(652,98,'Sellable shelf',18,c.green);
|
|
flow('M457 202 H533 V142 H643',2,c.green);show(rect(748,118,34,25,c.green,c.green,1),4);
|
|
rect(645,246,239,65,'#302633',c.red);path('M651 246 L877 311 M877 246 L651 311',c.red,1);text(663,340,'Damage / quarantine',18,c.red);flow('M533 202 V278 H643',2,c.red);
|
|
path('M478 281 V374 H579',c.line,3);flow('M478 281 V374 H579',3,c.blue);
|
|
rect(580,351,305,65,'#18314a',c.blue);text(599,378,'Refund record',18,c.blue);text(599,401,'Financial state ≠ stock state',16,c.muted);
|
|
text(39,437,'Condition drives disposition · policy determines refund eligibility',16,c.muted);
|
|
|
|
const units=Math.max(1,Math.min(3,Math.round(Number(config.restockUnits)||2)));
|
|
const flap=path('M43 179 L108 154 L173 179',c.amber,4);
|
|
const opened=s.E('path',{d:'M43 179 L88 128 L153 153',visibility:'hidden'});
|
|
s.tl.add(flap,{d:kit.anime.svg.morphTo(opened),duration:s.p*.65},s.p);
|
|
for(let i=0;i<units;i++){const unit=rect(327+i*30,166,23,25,'#2d5a5a',c.green,2);s.tl.add(unit,{x:[327+i*30,735+i*34],y:[166,148],duration:s.p*.75},4*s.p);}
|
|
|
|
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
|
|
};
|
|
})();
|