Deck.transition('portal-out',{dur:1.4,frag:`void main(){ vec2 uv=vUv-.5; float e=smoothstep(0.,1.,p); float h=mix(.02,.55,e); float hc=min(h,.5); float vis=smoothstep(0.,.10,p); vec2 buv=clamp(uv/(2.*hc)+.5,vec2(.002),vec2(.998)); float ins=step(abs(uv.x),hc)*step(abs(uv.y),hc)*vis; vec3 A=texture(tA,uv/(1.+.4*e)+.5).rgb*(1.-.5*e); vec3 B=texture(tB,buv).rgb; vec3 col=mix(A,B,ins); float d=max(abs(uv.x),abs(uv.y))-h; col=mix(col,vec3(.93,.94,.96),smoothstep(.016,0.,abs(d))*vis); o=vec4(col,1.); }`}); Deck.scene({ id:'questions', title:'Any questions?', enterWith:'portal-out', post:{tone:'none'}, beats:[{dur:2,hold:4},{dur:3.4,hold:4},{dur:8.4,hold:6}], notes:[ 'Any questions? (Back to the dull template. Let people think it is over.)', '(Press next and look at the screen, not at the room.)', 'Leave it up. That is the question the whole talk comes down to: something is going to be able to edit the world, and we have to be able to say what we want. (After a few seconds the slide tilts by one degree.)' ], setup(d){ return { bg:d.pass(`void main(){ vec2 p=(vUv-.5)*vec2(uRes.x/uRes.y,1.); vec3 c=vec3(.028,.031,.038); c+=vec3(.030,.038,.055)*exp(-length(p*vec2(.85,1.25))*1.5); c*=.86+.28*fbm(vUv*vec2(10.,6.)+uTime*.015); c+=(hash12(vUv*uRes)-.5)*.010; o=vec4(c,1.); }`,'questions backdrop') }; }, draw(s,d,r){ r.bg.draw(); const E=d.E, c=d.ctx2d; const SW=1640, SH=922.5, HW=SW/2, HH=SH/2; const tilt=s.k(2,6.4,8.4,E.io3); c.save(); c.translate(960+s.mouse.x*10,540+s.mouse.y*8); c.rotate(tilt*Math.PI/180); const sc=1-.08*tilt; c.scale(sc,sc); c.save(); c.shadowColor='rgba(0,0,0,'+(0.75*tilt).toFixed(3)+')'; c.shadowBlur=100*tilt; c.shadowOffsetY=36*tilt; c.fillStyle='#fbfbf8'; c.fillRect(-HW,-HH,SW,SH); c.restore(); d.rect(-HW,HH-13,SW,13,'#2f5f9e'); d.text('Any questions?',{x:0,y:-165,size:98,font:'arial',color:'#1a1a1a',align:'center',show:s.k(0,0.05,0.9,E.lin)}); let fw=d.text('What do you want?',{x:0,y:0,size:58,font:'arial',show:0}).w; if(!(fw>10)) fw=500; const x0=-fw/2, LY=60; let line=''; if(s.beat<2){ line='I have one.'.slice(0,Math.round(s.k(1,1.1,2.6,E.lin)*11)); }else{ const del=s.k(2,0.2,0.8,E.lin); const n=Math.round(s.k(2,1.1,2.7,E.lin)*17); line = n>0 ? 'What do you want?'.slice(0,n) : 'I have one.'.slice(0,Math.round((1-del)*11)); } const lineA=s.k(1,0.15,2.5,E.lin); const tb = line.length ? d.text(line,{x:x0,y:LY,size:58,font:'arial',color:'#1a1a1a',align:'left',show:lineA}) : null; const visW = tb ? tb.w : 0; const g=s.k(2,3.4,5.0,E.io3); const br=Math.sin(s.t*1.25)*4*s.k(2,5.0,5.8,E.lin); const lx=x0-24, ly=LY-20, lw=Math.max(visW+48,70), lh=96; const sbx=-HW+26, sby=-HH+26, sbw=SW-52, sbh=SH-52; const bx=lx+(sbx-lx)*g-br, by=ly+(sby-ly)*g-br; const bw=lw+(sbw-lw)*g+br*2, bh=lh+(sbh-lh)*g+br*2; const blink=(s.t%1.06)<0.58?1:0; const careA=lineA*blink*(1-Math.min(g,1)); if(careA>0.01) d.rect(x0+visW+5,LY+3,4,54,'#1a1a1a',careA); d.select(bx,by,bw,bh,{a:s.k(1,0.15,0.9,E.lin)}); c.restore(); } });