[verified] feat: expand public animation library across 12 industries

This commit is contained in:
jarvis-at-skic committed 2026-10-25 18:14:35 +00:00
1 parent 3bb9555e6a
commit ecbbcf8ba0
144 files changed
+61323 -187

No files matched your search

@@ -0,0 +1,87 @@
(function () {
'use strict';
window.industryRenderers ??= {};
function scene(svg, config, kit, title, subtitle, phases, note) {
const {anime,el}=kit;
const C={bg:'#0b1424',panel:'#15243a',line:'#68809d',ink:'#edf4ff',muted:'#b2c4da',cyan:'#57d9ed',green:'#82e0b0',amber:'#ffd078',red:'#ff8a94'};
const D=Number.isFinite(+config.duration)&&+config.duration>0?+config.duration:6000;
const tl=anime.createTimeline({autoplay:false,defaults:{ease:'linear'}});
function e(t,a={},text='',p=svg){return el(t,a,text,p);}
function g(){return e('g');}
function rect(x,y,w,h,fill=C.panel,stroke=C.line,p=svg,r=8){return e('rect',{x,y,width:w,height:h,rx:r,fill,stroke,'stroke-width':2},'',p);}
function text(x,y,s,fill=C.ink,size=18,p=svg){return e('text',{x,y,fill,'font-size':size,'font-family':'system-ui, sans-serif'},s,p);}
function path(d,color=C.line,width=3,p=svg){return e('path',{d,fill:'none',stroke:color,'stroke-width':width,'stroke-linecap':'round','stroke-linejoin':'round'},'',p);}
function circle(x,y,r,fill=C.cyan,p=svg){return e('circle',{cx:x,cy:y,r,fill},'',p);}
const tracks=new WeakMap();
function tween(o,attrs,start,end){
let previous=tracks.get(o);if(!previous){previous={};tracks.set(o,previous);}
for(const [key,values] of Object.entries(attrs)){
const old=previous[key];
// Anime v4 needs explicit holds across gaps for reverse seeking.
if(old && start>old.end)tl.add(o,{[key]:[old.value,old.value],duration:(start-old.end)*D/6000},old.end*D/6000);
previous[key]={end,value:values[values.length-1]};
}
tl.add(o,{...attrs,duration:(end-start)*D/6000},start*D/6000);
}
function reveal(o,start,end= start+650){o.setAttribute('opacity','0');tween(o,{opacity:[0,1]},start,end);}
function flow(d,start,end,color=C.cyan,width=5){const p=path(d,color,width);const len=p.getTotalLength();p.setAttribute('stroke-dasharray',len);p.setAttribute('stroke-dashoffset',len);tween(p,{strokeDashoffset:[len,0]},start,end);return p;}
function parcel(x,y,color=C.amber){const p=g();rect(x,y,36,28,color,'#0b1424',p,3);path(`M${x+18} ${y} V${y+28}`,'#736146',2,p);return p;}
function person(x,y,color=C.cyan){const p=g();circle(x,y,10,color,p);path(`M${x} ${y+15} V${y+43} M${x-15} ${y+25} H${x+15} M${x} ${y+43} L${x-12} ${y+60} M${x} ${y+43} L${x+12} ${y+60}`,color,6,p);return p;}
function gear(x,y,r,color=C.line){const p=g();for(let i=0;i<12;i++){const a=i*Math.PI/6;path(`M${x+Math.cos(a)*(r-5)} ${y+Math.sin(a)*(r-5)} L${x+Math.cos(a)*(r+7)} ${y+Math.sin(a)*(r+7)}`,color,8,p);}circle(x,y,r,color,p);circle(x,y,r*.45,C.bg,p);return p;}
rect(10,10,940,520,C.bg,C.panel,svg,16);
const heading=text(32,43,title,C.ink,25);
const words=subtitle.split(' ');let line='',row=0;for(const w of words){if((line+' '+w).length>104){text(32,70+row*19,line,C.muted,16);line=w;row++;}else line+=(line?' ':'')+w;}if(line)text(32,70+row*19,line,C.muted,16);
path('M32 426 H928',C.line,1);
phases.forEach((s,i)=>{const x=47+i*183;circle(x,455,13,C.panel);const dot=circle(x,455,11,C.cyan);dot.setAttribute('opacity','.18');tween(dot,{opacity:[.18,1]},i*1200,i*1200+700);text(x+21,461,s,C.ink,16);});
text(32,510,note,C.muted,16);
tween(heading,{opacity:[1,1]},0,6000);
return {C,D,tl,e,g,rect,text,path,circle,tween,reveal,flow,parcel,person,gear};
}
window.industryRenderers["manufacturing-takt-buffer"] = function(svg, config, kit) {
const s=scene(svg,config,kit,"Assembly flow: bottleneck and buffer","Three assembly stations expose an uneven cycle; a small buffer absorbs the mismatch while work is rebalanced.",["Feed chassis", "Assemble", "Queue grows", "Rebalance", "Release units"],"Amber = waiting work \u00b7 Cyan = active assembly \u00b7 Green = completed unit");
const {C,tl,g,rect,text,path,circle,tween,reveal,flow,gear}=s;
text(48,120,'01 CHASSIS',C.muted,18);text(352,120,'02 FIT & FASTEN',C.cyan,18);text(714,120,'03 VERIFY',C.muted,18);
rect(42,282,870,63,'#23354a',C.line);for(let x=55;x<900;x+=25)circle(x,315,8,C.line);
path('M72 280 V191 H228 V280',C.line,7);path('M116 194 V222 H182 V194',C.cyan,5);
// Articulated assembly arm, gripper and component rack.
rect(386,236,62,43,C.panel,C.cyan);path('M416 239 L461 190 L506 226 L526 212',C.cyan,11);circle(461,190,13,C.ink);circle(506,226,9,C.ink);path('M517 209 L526 228 L538 213',C.amber,4);
gear(360,215,18,C.line);rect(538,152,53,65,C.panel,C.line);for(let y=165;y<209;y+=17)path(`M546 ${y} H584`,C.amber,4);
path('M744 281 V177 H855 V281',C.green,7);path('M760 197 H840',C.green,3);
function chassis(x,y,color){const p=g();rect(x,y,66,26,C.panel,color,p,5);circle(x+13,y+28,7,C.line,p);circle(x+53,y+28,7,C.line,p);return p;}
const unit=chassis(97,256,C.cyan);tween(unit,{translateX:[0,306]},0,1600);tween(unit,{translateX:[306,306]},1600,3600);tween(unit,{translateX:[306,654]},4000,5600);
const top=path('M112 255 L124 240 H147 L158 255',C.green,4);top.setAttribute('opacity',0);tween(top,{opacity:[0,1],translateX:[306,306]},1700,2300);tween(top,{translateX:[306,654]},4000,5600);
const slots=Math.max(1,Math.min(3,Math.round(+config.bufferSlots||2)));const queue=[];for(let i=0;i<slots;i++){const q=chassis(130+i*72,256,C.amber);reveal(q,2200+i*250,2600+i*250);queue.push(q);}
path('M127 353 V365 H353 V353',C.amber,3);text(143,391,'Buffer: '+slots+' slots',C.amber,17);
const warn=text(352,153,'Longer station cycle',C.amber,16);reveal(warn,2200,2800);
flow('M614 178 Q661 133 702 178',3500,4300,C.green);text(604,214,'Shift checks',C.green,16);text(604,237,'downstream',C.muted,16);
queue.forEach((q,i)=>tween(q,{translateX:[0,222]},4300+i*200,6000));
text(51,391,'Buffer buys time, not capacity.',C.muted,16); // moved below by explicit position adjustment
const labels=svg.querySelectorAll('text');labels[labels.length-1].setAttribute('y','414');
text(718,391,'Verification gate',C.green,17);
return tl;
};
window.industryRenderers["manufacturing-fault-rework"] = function(svg, config, kit) {
const s=scene(svg,config,kit,"Machine fault: isolate, inspect and rework","A machining fault stops the affected cell; a suspect part leaves the main line for inspection, rework and verification.",["Machine part", "Detect fault", "Contain lot", "Rework", "Verify release"],"Red = isolated cell \u00b7 Amber = suspect part \u00b7 Green = verified return path");
const {C,tl,g,rect,text,path,circle,tween,reveal,flow,gear}=s;
text(49,118,'MACHINING CELL',C.muted,17);text(702,118,'QUALITY GATE',C.muted,17);
rect(59,139,258,190,C.panel,C.line);rect(82,160,211,123,C.bg,C.line);path('M105 296 H273',C.line,8);
path('M185 161 V194 M164 194 H206 L198 219 H172 Z',C.cyan,7);path('M112 262 H258',C.line,5);gear(111,183,14,C.line);
const spindle=path('M184 219 V242',C.cyan,7);tween(spindle,{translateY:[0,12]},0,900);tween(spindle,{translateY:[12,0]},900,1500);
const fault=circle(284,148,9,C.red);reveal(fault,1500,2100);const isolation=path('M63 136 L310 324 M310 136 L63 324',C.red,3);reveal(isolation,2400,3000);
text(60,357,'Cell isolated; lot retained',C.red,16);text(60,383,'Repair ≠ product release',C.muted,16);
path('M320 249 H701',C.line,6);path('M346 232 V266',C.red,6);
rect(396,158,266,64,C.bg,C.amber);text(411,184,'CONTAINMENT',C.amber,17);text(411,207,String(config.lotId||'LOT A').slice(0,14)+' · inspect',C.muted,16);
// A rework bench with vise, tool and part cradle.
path('M439 350 H657 M457 350 V405 M638 350 V405',C.line,6);rect(473,324,69,24,C.panel,C.amber);path('M487 323 V309 H528 V323',C.amber,4);path('M583 306 L609 333 M576 296 L583 306 L595 299',C.cyan,6);
text(458,389,'REWORK BENCH',C.amber,17);
path('M731 291 V156 H865 V291',C.green,6);path('M754 181 H841 M766 194 H831',C.green,2);
text(716,325,'Recheck required',C.green,17);text(716,352,'before line return',C.muted,16);
const part=g();circle(185,248,17,C.amber,part);circle(185,248,7,C.bg,part);
tween(part,{translateX:[0,447],translateY:[0,0]},1600,2400);tween(part,{translateX:[447,447],translateY:[0,-56]},2400,2700);tween(part,{translateX:[447,447],translateY:[-56,28]},3200,3500);tween(part,{translateX:[447,322],translateY:[28,72]},3500,4200);tween(part,{translateX:[322,610],translateY:[72,0]},4800,5800);
flow('M490 224 V290 H510 V310',3100,4000,C.amber);flow('M550 333 H682 V249 H788',4400,5800,C.green);
const check=path('M779 277 L791 287 L818 263',C.green,4);reveal(check,5400,6000);
return tl;
};
})();