main
John Lauer
Add clean cinematic R11 assembly reveal and reusable 1080p tour clip
a6248f1
while(!window.review?.ready) await new Promise(r=>setTimeout(r,100));
const scene=review.viewer.getScene(), cam=scene.activeCamera;
review.viewer.toggleAxes("world",false);
cam.detachControl();cam.lowerRadiusLimit=.04;cam.upperRadiusLimit=1;
const meshes=scene.meshes;
const groups={
duct:meshes.filter(m=>/^(Duct_|Fan_lower|Fan_upper)/.test(m.name)),
sink:meshes.filter(m=>/^(ATS_sink|Sink_ear|Sink_retainer)/.test(m.name)),
interface:meshes.filter(m=>/^(AlN_|Q1_screw|Q1_shoulder)/.test(m.name)),
fan:meshes.filter(m=>/^(Fan[._]|Fan_)/.test(m.name)&&! /^(Fan_lower|Fan_upper)/.test(m.name)),
carrier:meshes.filter(m=>/^Carrier_/.test(m.name))
};
const smooth=x=>{x=Math.max(0,Math.min(1,x));return x*x*(3-2*x)};
const keys=[
[0,-1.0,1.03,.175,.034,.033,.025],
[8,.15,.90,.168,.034,.033,.025],
[17,1.7,.82,.170,.034,.033,.025],
[24,2.5,.72,.160,.034,.033,.020],
[32,3.45,.58,.145,.034,.033,.014],
[40,4.25,.45,.130,.034,.033,.009],
[48,5.1,.72,.140,.034,.033,.008],
[56,5.8,.56,.145,.034,.033,.008]
];
function frame(t){
let i=0;while(i<keys.length-2&&t>keys[i+1][0])i++;
const a=keys[i],b=keys[i+1],u=smooth((t-a[0])/(b[0]-a[0]));
const v=a.map((x,j)=>x+(b[j]-x)*u);
cam.alpha=v[1];cam.beta=v[2];cam.radius=v[3];cam.target.set(v[4],v[5],v[6]);
for(const [group,start] of [['duct',17],['sink',26],['interface',31],['fan',36],['carrier',42]]){
const opacity=1-smooth((t-start)/3);
for(const m of groups[group]){m.visibility=opacity;m.setEnabled(opacity>0);}
}
window.tour.time=t;
}
let start=null;
window.tour={ready:true,time:0,duration:56,groups:Object.fromEntries(Object.entries(groups).map(([k,v])=>[k,v.length])),seek:frame,start(){start=performance.now();this.done=false},stop(){start=null}};
scene.onBeforeRenderObservable.add(()=>{if(start!==null){const t=Math.min(56,(performance.now()-start)/1000);frame(t);if(t>=56){start=null;tour.done=true;}}});
frame(0);