85 lines
8.1 KiB
JavaScript
85 lines
8.1 KiB
JavaScript
/* Original conceptual teaching scenes. No operational or engineering model. */
|
|
(function () {
|
|
'use strict';
|
|
window.industryRenderers ??= {};
|
|
const C={bg:'#101d30',panel:'#182b42',line:'#667c95',ink:'#edf5ff',muted:'#aec1d7',cyan:'#57d4ed',green:'#85e0ad',amber:'#ffd178',red:'#ff8c8c'};
|
|
function scene(svg,config,kit,title,subtitle,phases,note){
|
|
const {anime,el}=kit, duration=Math.max(3000,Number(config.duration)||6000), unit=duration/6;
|
|
const tl=anime.createTimeline({autoplay:false,defaults:{ease:'linear'}});
|
|
const E=(tag,a={},text='',p=svg)=>el(tag,a,text,p);
|
|
const rect=(x,y,w,h,fill=C.panel,p=svg,extra={})=>E('rect',{x,y,width:w,height:h,rx:8,fill,...extra},'',p);
|
|
const text=(x,y,t,size=18,fill=C.ink,p=svg,extra={})=>E('text',{x,y,fill,'font-size':size,'font-family':'system-ui, sans-serif',style:`fill:${fill};font-size:${size}px;font-family:system-ui,sans-serif`,...extra},t,p);
|
|
const path=(d,color=C.line,width=3,p=svg,extra={})=>E('path',{d,fill:'none',stroke:color,'stroke-width':width,'stroke-linecap':'round','stroke-linejoin':'round',...extra},'',p);
|
|
const circle=(cx,cy,r,fill=C.cyan,p=svg,extra={})=>E('circle',{cx,cy,r,fill,...extra},'',p);
|
|
const group=()=>E('g');
|
|
const add=(target,props,at=0,len=.75)=>tl.add(target,{...props,duration:unit*len},unit*at);
|
|
const reveal=(target,at)=>{target.setAttribute('opacity','0.12');add(target,{opacity:[.12,1]},at);return target;};
|
|
const draw=(d,at,color=C.cyan,width=4)=>{const p=path(d,color,width);p.setAttribute('pathLength','1');p.setAttribute('stroke-dasharray','1');p.setAttribute('stroke-dashoffset','1');add(p,{'stroke-dashoffset':[1,0]},at);return p;};
|
|
rect(0,0,960,540,C.bg,svg,{rx:0}); text(32,39,title,26);text(32,69,subtitle,17,C.muted);
|
|
path('M32 88 H928',C.line,1);
|
|
phases.forEach((label,i)=>{const x=32+i*181;rect(x,440,172,44);const bar=rect(x,440,172,4,C.cyan,svg,{rx:0});add(bar,{opacity:[.15,1]},i,.65);text(x+10,469,`${i+1} ${label}`,16);});
|
|
text(32,516,note,16,C.muted);
|
|
const clock=E('g',{'data-clock':'finite'});add(clock,{opacity:[1,1]},0,6);
|
|
return {svg,config,tl,E,rect,text,path,circle,group,add,reveal,draw,C};
|
|
}
|
|
window.industryRenderers["agriculture-irrigation-zones"] = function(svg, config, kit) {
|
|
|
|
const wet=Math.min(2,Math.max(0,Math.round(Number(config.wetZone??1))));
|
|
const dryNames=['north','middle','south'].filter((_,i)=>i!==wet);
|
|
const s=scene(svg,config,kit,'IRRIGATION / ZONES, NOT A BLANKET','A conceptual controller waters two dry zones while bypassing an already wet strip.',
|
|
['Read soil','Open '+dryNames[0],'Soak '+dryNames[0],'Open '+dryNames[1],'Close valves'],'Illustrative only • cyan = water path • green = wet-enough indication • no agronomic thresholds');
|
|
const {rect,text,path,circle,group,add,reveal,draw,C}=s;
|
|
// Reservoir with a pump impeller and main water header.
|
|
path('M43 170 H155 V336 Q99 362 43 336 Z',C.muted,3);rect(47,255,104,76,'#245d78',svg,{rx:0});
|
|
path('M48 255 Q65 247 82 255 T116 255 T150 255',C.cyan,3);text(48,386,'Reservoir',17);
|
|
circle(203,301,27,'#28455b',svg,{stroke:C.cyan,'stroke-width':3});path('M189 301 L214 288 L207 314 Z',C.cyan,3);text(177,349,'Pump',17);
|
|
path('M155 301 H176 M230 301 H264 V152 H843 M264 261 H843 M264 370 H843',C.line,6);
|
|
// Furrows and crops make three distinct field strips.
|
|
let order=0;
|
|
const zones=['North','Middle','South'].map((name,i)=>({y:118+109*i,name:name+(i===wet?' • already wet':' • initially dry'),at:i===wet?null:(order++===0?1:3)}));
|
|
zones.forEach((z,i)=>{
|
|
rect(337,z.y,492,91,'#263e32',svg,{stroke:'#58754a'});
|
|
for(let row=0;row<3;row++){path(`M353 ${z.y+23+row*24} H813`,'#635d3a',2);for(let col=0;col<8;col++){const x=365+col*57,y=z.y+20+row*24;path(`M${x} ${y+9} V${y-1} M${x} ${y+3} L${x-7} ${y-3} M${x} ${y} L${x+7} ${y-6}`,C.green,2);}}
|
|
const cy=z.y+34;circle(302,cy,15,'#1a2b3d',svg,{stroke:i===wet?C.green:C.amber,'stroke-width':3});path(`M292 ${cy} H312`,C.muted,3);
|
|
text(345,z.y+86,z.name,16,C.ink);
|
|
// Sensor/gauge outside the crop geometry, with a clear water-level response.
|
|
rect(859,z.y+5,22,66,'#122638',svg,{stroke:C.line});const level=rect(862,z.y+(i===wet?18:52),16,i===wet?50:16,i===wet?C.green:C.amber,svg,{rx:1});text(840,z.y+88,['N soil','M soil','S soil'][i],16,C.muted);
|
|
if(z.at!==null){const flow=draw(`M264 ${cy} H286 M318 ${cy} H815`,z.at,C.cyan,4);add(flow,{opacity:[1,.18]},4.5,.5);add(level,{y:[z.y+52,z.y+18],height:[16,50],fill:[C.amber,C.green]},z.at+.5,1);const handle=path(`M302 ${cy-10} V${cy+10}`,C.cyan,4);reveal(handle,z.at);add(handle,{opacity:[1,1]},z.at+.75,4.2-z.at-.75);add(handle,{opacity:[1,.15]},4.2,.6);}
|
|
else{text(592,z.y+86,'Bypass • no demand',16,C.green);}
|
|
});
|
|
text(44,125,'Stored supply',17);const closed=group();rect(45,398,270,26,'#2d473b',closed);text(55,417,'Cycle complete • valves closed',16,C.green,closed);reveal(closed,4.3);
|
|
return s.tl;
|
|
|
|
};
|
|
window.industryRenderers["agriculture-harvest-grading"] = function(svg, config, kit) {
|
|
|
|
const s=scene(svg,config,kit,'HARVEST / PRESERVE LOT IDENTITY','Grade at inspection, separate destinations, and keep the origin visible in each branch.',
|
|
['Receive lot','Inspect','Separate','Store','Dispatch'],'Conceptual produce flow • green = fresh route • amber = processing route • no food-safety claim');
|
|
const {rect,text,path,circle,group,add,reveal,draw,C}=s;
|
|
// Orchard rows and reusable harvest crate.
|
|
[68,112,156].forEach((x,i)=>{path(`M${x} 178 V234`,C.line,7);circle(x,167,26,'#375f42');circle(x-8,163,5,C.amber);circle(x+9,176,5,C.amber);});
|
|
rect(49,269,140,78,'#5e4930',svg,{stroke:C.amber});[284,306,328].forEach(y=>path(`M54 ${y} H184`,C.muted,2));text(59,371,'Origin lot L',17);text(49,403,'Orchard harvest',16,C.muted);
|
|
const picked=group();[76,107,138,166].forEach(x=>circle(x,268,10,C.green,picked));reveal(picked,0);
|
|
// Belt, rollers and inspection light.
|
|
rect(236,257,278,61,'#304455',svg,{rx:28});for(let i=0;i<7;i++)circle(260+i*37,288,13,'#162738',svg,{stroke:C.line,'stroke-width':2});
|
|
path('M310 253 V160 H422 V253',C.muted,5);rect(323,162,86,23,'#4b5860');path('M332 190 L311 249 H422 L400 190',C.amber,2,svg,{'stroke-dasharray':'5 5'});
|
|
text(297,142,'Inspection gate',18);text(266,348,'Size / appearance review',16,C.muted);
|
|
const fruit=circle(246,247,12,C.green);add(fruit,{cx:[246,493]},.6,1.4);
|
|
const review=group();circle(363,222,17,'none',review,{stroke:C.amber,'stroke-width':3});reveal(review,1);
|
|
// Mechanical diverter separates two gravity chutes.
|
|
path('M514 280 L559 233 L606 192 M514 288 L559 333 L606 367',C.line,7);const gate=path('M520 282 L548 259',C.cyan,5);add(gate,{d:['M520 282 L548 259','M520 282 L548 309']},2,.65);
|
|
draw('M514 275 L606 184',2,C.green,4);draw('M514 292 L606 375',2.5,C.amber,4);
|
|
text(510,117,'Fresh grade',16,C.green);text(521,410,'Processing grade',16,C.amber);
|
|
// Ventilated cold room with crates; separate processing silo.
|
|
rect(616,123,142,111,'#214659',svg,{stroke:C.cyan});path('M687 124 V233',C.line,2);text(628,150,'Cool store',17);[0,1].forEach(i=>{rect(627+i*61,167,49,48,'#31583f');text(637+i*61,196,'L',20,C.green);});reveal(s.E('path',{d:'M640 115 V101 M634 108 H646 M698 115 V101 M692 108 H704',stroke:C.cyan,'stroke-width':2}),3);
|
|
path('M632 304 Q684 279 736 304 V372 L684 404 L632 372 Z',C.amber,3);text(641,335,'Process bin',16);text(650,361,'Lot L kept',16,C.amber);
|
|
const fresh=Math.min(3,Math.max(1,Math.round(Number(config.freshCount)||3)));
|
|
for(let i=0;i<4;i++){const good=i<fresh,produce=circle(520,282,8,good?C.green:C.amber);reveal(produce,2+i*.18);add(produce,{cx:[520,good?638+i*26:655+(i-fresh)*20],cy:[282,good?206:379]},2+i*.18,.8);}
|
|
// Two distinct dispatch vehicles retain lot markers.
|
|
function truck(y,color,label){const g=group();rect(807,y,72,43,'#304961',g);path(`M879 ${y+14} H900 L917 ${y+32} V${y+43} H879 Z`,color,3,g);circle(826,y+46,10,C.line,g);circle(896,y+46,10,C.line,g);text(826,y+29,'L',20,color,g);text(791,y+82,label,16,C.ink,g);reveal(g,4);}
|
|
truck(146,C.green,'Fresh market');truck(315,C.amber,'Processor');draw('M760 183 H803',4,C.green);draw('M740 349 H803',4.2,C.amber);
|
|
return s.tl;
|
|
|
|
};
|
|
})();
|