[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,80 @@
|
||||
(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["healthcare-care-handoffs"] = function(svg, config, kit) {
|
||||
const s=scene(svg,config,kit,"Care coordination: triage and handoffs","Follow registration, triage review, care-team handoff and discharge coordination, with an information gap resolved.",["Register", "Triage review", "Resolve gap", "Team accepts", "Coordinate exit"],"Cyan = person journey \u00b7 Amber = missing information \u00b7 Green = accepted handoff");
|
||||
|
||||
const {C,tl,g,rect,text,path,circle,tween,reveal,flow,person}=s;
|
||||
text(44,117,'ARRIVAL',C.muted,17);text(267,117,'TRIAGE REVIEW',C.muted,17);text(514,117,'CARE TEAM',C.muted,17);text(766,117,'NEXT SETTING',C.muted,17);
|
||||
// Reception counter, review chairs, care bed and exit doorway.
|
||||
path('M52 219 H205 V283 H52 Z',C.line,3);rect(138,174,49,34,C.panel,C.cyan);path('M160 208 V219',C.line,4);person(92,172,C.muted);
|
||||
path('M282 220 V254 H319 V280 M282 254 V280 M343 220 V254 H380 V280 M343 254 V280',C.line,5);person(332,158,C.cyan);
|
||||
path('M510 238 H677 V272 H510 V209 M675 235 V278',C.line,6);rect(524,215,41,21,C.muted,C.muted);path('M567 220 H651 V239',C.cyan,5);circle(532,282,7,C.line);circle(657,282,7,C.line);
|
||||
rect(790,152,89,132,C.bg,C.green);path('M800 160 L852 173 V280',C.green,3);circle(841,227,4,C.green);path('M815 130 H871 M861 122 L871 130 L861 138',C.green,3);
|
||||
path('M69 310 H878',C.line,3);
|
||||
const patient=person(81,288,C.cyan);tween(patient,{translateX:[0,248]},0,1700);tween(patient,{translateX:[248,248]},1700,3500);tween(patient,{translateX:[248,505]},3600,4500);tween(patient,{translateX:[505,749]},4800,5900);
|
||||
flow('M146 151 H261',600,1400);flow('M383 151 H504',3500,4300,C.green);flow('M679 151 H779',4700,5600,C.green);
|
||||
rect(263,369,224,41,C.bg,C.amber);const missing=text(276,396,'Missing referral details',C.amber,16);tween(missing,{opacity:[1,0]},3400,3700);const resolved=text(276,396,'Referral gap resolved',C.green,16);reveal(resolved,3700,4000);
|
||||
const question=text(417,210,'?',C.amber,32);reveal(question,2400,2800);tween(question,{opacity:[1,0]},3400,3700);const accepted=path('M410 201 L420 211 L437 190',C.green,4);reveal(accepted,3700,4000);
|
||||
flow('M423 224 V356 H193 V286',2400,3300,C.amber,3);flow('M203 286 V343 H408 V223',3100,3900,C.green,3);
|
||||
text(519,370,String(config.handoffRole||'Care coordinator').slice(0,22)+' accepts',C.green,17);text(519,398,'before ownership transfers.',C.muted,16);
|
||||
text(47,394,'No treatment logic',C.muted,16);
|
||||
return tl;
|
||||
};
|
||||
window.industryRenderers["healthcare-sample-rejection"] = function(svg, config, kit) {
|
||||
const s=scene(svg,config,kit,"Diagnostic sample chain: reject and recollect","A labeled tube passes accession and inspection; an unsuitable specimen is held while a linked replacement reaches analysis.",["Label & send", "Accession", "Reject & hold", "Recollect", "Analyze & report"],"Amber = held specimen \u00b7 Cyan = replacement specimen \u00b7 Green = accepted result record");
|
||||
|
||||
const {C,tl,g,rect,text,path,circle,tween,reveal,flow}=s;
|
||||
text(43,117,'COLLECTION',C.muted,17);text(269,117,'ACCESSION',C.muted,17);text(511,117,'INSPECTION',C.muted,17);text(753,117,'ANALYZER',C.muted,17);
|
||||
function tube(x,y,color){const p=g();path(`M${x} ${y} V${y+46} Q${x+11} ${y+62} ${x+22} ${y+46} V${y} Z`,color,3,p);rect(x-2,y-7,26,10,color,color,p,2);rect(x+4,y+16,14,17,C.ink,C.ink,p,1);return p;}
|
||||
path('M48 263 H195 M62 263 V295 M180 263 V295',C.line,5);for(let x=70;x<180;x+=34)tube(x,209,C.line);
|
||||
rect(280,172,149,99,C.panel,C.line);rect(295,187,117,51,C.bg,C.cyan);for(let x=309;x<396;x+=9)path(`M${x} 197 V226`,C.cyan,x%2?2:4);text(285,295,String(config.sampleId||'S-042').slice(0,10)+' registered',C.muted,16);
|
||||
// Magnifier inspection and containment rack.
|
||||
circle(574,207,35,C.panel);circle(574,207,29,C.bg);path('M599 230 L626 257',C.line,9);path('M560 207 H588 M574 193 V221',C.amber,3);
|
||||
rect(506,323,164,71,C.bg,C.amber);text(520,349,'REJECTED',C.amber,16);text(520,378,String(config.sampleId||'S-042').slice(0,10)+' held',C.muted,16);
|
||||
rect(750,161,155,121,C.panel,C.line);rect(770,179,76,42,C.bg,C.green);path('M779 205 H790 L800 189 L811 213 L823 197 H838',C.green,2);circle(873,198,11,C.cyan);rect(767,240,118,23,C.bg,C.line);text(751,307,'Accepted sample only',C.green,16);
|
||||
path('M190 247 H279 M430 247 H506 M635 247 H747',C.line,3);
|
||||
const original=tube(110,178,C.amber);tween(original,{translateX:[0,228]},0,1300);tween(original,{translateX:[228,453]},1400,2300);tween(original,{translateX:[453,529],translateY:[0,160]},2600,3300);
|
||||
flow('M504 371 H236 V308 H123 V280',3000,3950,C.amber,3);text(241,402,'Recollect: linked replacement',C.cyan,16);
|
||||
const replacement=tube(110,178,C.cyan);reveal(replacement,3600,3900);tween(replacement,{translateX:[0,453]},3900,4700);tween(replacement,{translateX:[453,693]},4800,5500);
|
||||
rect(758,334,146,68,C.bg,C.green);text(773,361,'RESULT RECORD',C.green,16);text(773,386,String(config.sampleId||'S-042').slice(0,10)+'-R linked',C.muted,16);flow('M829 284 V329',5500,6000,C.green);
|
||||
text(43,345,'Do not erase the',C.muted,17);text(43,370,'rejected sample trail.',C.muted,17);
|
||||
return tl;
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user