[verified] feat: expand public animation library across 12 industries
This commit is contained in:
1 parent
3bb9555e6a
commit
ecbbcf8ba0
144 files changed
+61323
-187
No files matched your search
@@ -0,0 +1,93 @@
|
||||
/* 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['oil-gas-separator-upset'] = function(svg,config,kit){
|
||||
const s=scene(svg,config,kit,"Separator train: contain an upset","Separate the streams; isolate one train without hiding the recovery route.",["Feed split", "Separation", "Upset held", "Train isolated", "Stable route"]);
|
||||
|
||||
const {text,path,rect,circle,show,flow,note,valve,c}=s;
|
||||
text(34,141,'Mixed feed',18);path('M45 212 H180 M180 173 V343 H240 M180 173 H240');
|
||||
function vessel(y,label){rect(240,y,280,90,'#172b40',c.blue,45);path(`M335 ${y+4} V${y+86}`,c.line,2);path(`M420 ${y+4} V${y+86}`,c.line,2);text(258,y+35,label,18);text(258,y+66,'gas / oil / water',16,c.muted);path(`M520 ${y+25} H595 M520 ${y+65} H640`);}
|
||||
vessel(125,'Train A');vessel(295,'Train B');
|
||||
const aFeed=flow('M45 212 H180 V173 H240',0,c.blue);s.tl.add(aFeed,{opacity:[1,.15],duration:s.p*.5},3*s.p);flow('M180 212 V343 H240',0,c.blue);
|
||||
text(609,112,'Gas header',18);text(653,177,'Oil header',18);text(658,247,'Water handling',18);
|
||||
path('M595 125 V320 M640 190 V360 M520 200 H625 V255 H820');
|
||||
const aGas=flow('M520 150 H595 V125 H825',1,c.amber);s.tl.add(aGas,{opacity:[1,.15],duration:s.p*.5},3*s.p);const aOil=flow('M520 190 H825',1,c.green), aWater=flow('M520 200 H625 V255 H820',1,c.blue);s.tl.add([aOil,aWater],{opacity:[1,.15],duration:s.p*.5},3*s.p);
|
||||
const alarm=circle(475,142,10,c.red);show(alarm,2);text(310,237,'A: level upset → hold',16,c.red);
|
||||
valve(216,173,3);valve(555,150,3);text(35,293,'Isolate A',18,c.red);text(35,317,'Keep B available',16,c.muted);
|
||||
flow('M520 320 H595 V125 H825',4,c.green);flow('M520 360 H640 V190 H825',4,c.green);flow('M520 377 H615 V255 H820',4,c.blue);
|
||||
note(660,307,265,'B carries accepted flow','Capacity not quantified',c.green,4);
|
||||
text(242,422,'Blue: feed / water Gold: gas Green: accepted route',16,c.muted);
|
||||
|
||||
const level=Math.max(12,Math.min(40,Number(config.feedLevel)||26));
|
||||
// Phase bands visibly rise in A, then drain after isolation. B stays stable.
|
||||
const fluidA=rect(428,201-level,67,level,'#4386a1','none',3);
|
||||
const oilA=rect(428,181-level,67,20,'#d3ac62','none',3);
|
||||
s.tl.add(fluidA,{height:[level,level+25],y:[201-level,176-level],duration:s.p*.65},2*s.p);
|
||||
s.tl.add(oilA,{y:[181-level,156-level],duration:s.p*.65},2*s.p);
|
||||
s.tl.add(fluidA,{height:[level+25,level+25],y:[176-level,176-level],duration:s.p*.35},2.65*s.p);
|
||||
s.tl.add(oilA,{y:[156-level,156-level],duration:s.p*.35},2.65*s.p);
|
||||
s.tl.add(fluidA,{height:[level+25,12],y:[176-level,189],duration:s.p*.7},3*s.p);
|
||||
s.tl.add(oilA,{y:[156-level,169],duration:s.p*.7},3*s.p);
|
||||
rect(428,371-level,67,level,'#4386a1','none',3);rect(428,351-level,67,20,'#d3ac62','none',3);
|
||||
const arm=path('M207 173 H225',c.amber,4);arm.style.transformBox='fill-box';arm.style.transformOrigin='center';
|
||||
s.tl.add(arm,{rotate:[0,90],duration:s.p*.4},3*s.p);
|
||||
const bead=circle(45,212,6,c.ink);s.move(bead,45,212,175,212,0);
|
||||
|
||||
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
|
||||
};
|
||||
window.industryRenderers['oil-gas-pipeline-reroute'] = function(svg,config,kit){
|
||||
const s=scene(svg,config,kit,"Pipeline leak: isolate and bypass","Two boundary valves contain the suspect segment before bypass flow resumes.",["Normal flow", "Leak alarm", "Close bounds", "Open bypass", "Supply restored"]);
|
||||
|
||||
const {text,path,rect,circle,show,flow,note,valve,c}=s;
|
||||
rect(38,181,100,115,'#172b40',c.blue,35);text(48,319,'Pump station',16);circle(88,235,28,'#263f58');path('M74 220 L104 235 L74 250 Z',c.blue,3);
|
||||
rect(815,176,108,118,'#172b40',c.blue,5);path('M815 176 L869 142 L923 176',c.blue,3);text(821,318,'Delivery',18);
|
||||
const by=Math.max(345,Math.min(380,Number(config.bypassY)||365));
|
||||
path('M138 235 H815',c.line,14);path(`M255 235 V${by} H700 V235`,c.line,12);
|
||||
text(355,199,'Monitored main segment',18);text(393,397,'Bypass corridor',18,c.green);
|
||||
const originalFlow=flow('M138 235 H815',0,c.blue);s.tl.add(originalFlow,{opacity:[1,.12],duration:s.p*.5},2*s.p);
|
||||
path('M436 224 L447 246 L457 223 L466 246',c.red,3);show(circle(452,268,9,c.red),1);
|
||||
text(379,297,'Suspected loss',18,c.red);valve(300,235,2);valve(650,235,2);
|
||||
text(263,155,'Boundary A',16,c.muted);text(611,155,'Boundary B',16,c.muted);
|
||||
show(circle(255,by,9,c.green),3);show(circle(700,by,9,c.green),3);
|
||||
flow(`M138 235 H255 V${by} H700 V235 H815`,4,c.green);
|
||||
note(35,101,206,'Detect ≠ locate','Alarm triggers review',c.amber,1);
|
||||
text(35,437,'Red crosses: closed boundaries · Green: alternate delivery path',16,c.muted);
|
||||
|
||||
// One finite packet follows each permitted route; the closed main dims.
|
||||
const depth=Math.max(345,Math.min(380,Number(config.bypassY)||365));
|
||||
const main=path('M138 235 H815',c.blue,3);
|
||||
s.tl.add(main,{opacity:[1,.12],duration:s.p*.5},2*s.p);
|
||||
const route=s.E('path',{d:`M138 235 H255 V${depth} H700 V235 H815`,fill:'none',stroke:c.green,'stroke-width':2});
|
||||
s.show(route,3);
|
||||
const first=circle(0,0,7,c.ink);
|
||||
s.tl.add(first,{...kit.anime.svg.createMotionPath(main),duration:s.p*.8},0);
|
||||
s.tl.add(first,{opacity:[1,0],duration:s.p*.1},s.p);
|
||||
const second=circle(0,0,7,c.ink);second.setAttribute('opacity','0');
|
||||
s.tl.add(second,{opacity:[0,1],duration:1},4*s.p);
|
||||
s.tl.add(second,{...kit.anime.svg.createMotionPath(route),duration:s.p*.85},4*s.p);
|
||||
|
||||
s.tl.seek(s.tl.duration);s.tl.seek(0);return s.tl;
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user