Deck.transition('portal-out',{dur:1.4,frag:`void main(){ float e=smoothstep(0.,1.,p); float s=mix(.15,1.,e); vec2 c=vUv-.5; vec4 A=texture(tA,c*(.15/s)+.5)*(1.-.6*e); vec4 B=texture(tB,c/s+.5); vec2 q=abs(c)-.5*s; float m=max(q.x,q.y); float inside=step(m,0.); float fr=smoothstep(.004,0.,abs(m))*(1.-e)*smoothstep(0.,.1,p); vec4 col=mix(A,B,inside*smoothstep(0.,.12,p)); col=mix(col,vec4(1.),fr); o=col; }`}); Deck.scene({ id:'questions', title:'Any questions?', enterWith:'portal-out', post:{tone:'none'}, beats:[{dur:.6,hold:4},{dur:2.4,hold:4},{dur:8.5,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 { q1:'I have one.', q2:'What do you want?', U:{uC:[960,540],uH:[960,540],uA:0,uS:1}, bg:d.pass(`uniform vec2 uC,uH; uniform float uA,uS; void main(){ vec2 q=design(vUv); vec2 dq=(q-uC)/uS; float cs=cos(uA),sn=sin(uA); vec2 l=vec2(dq.x*cs+dq.y*sn,-dq.x*sn+dq.y*cs); vec3 bg=vec3(.075,.08,.09)*(.85+.3*fbm(q*.004)); bg*=1.-.35*smoothstep(300.,1300.,length(q-uC)); float sd=sdBox(l-vec2(0.,34.),uH-30.); bg*=1.-.85*exp(-max(sd,0.)/70.); float dd=sdBox(l,uH)*uS; float m=smoothstep(1.,-1.,dd); vec3 sl=vec3(1.); float bar=smoothstep(-.5,.5,l.y-(uH.y-14.)); sl=mix(sl,vec3(.27,.45,.77),bar); vec3 c=mix(bg,sl,m); o=vec4(c,1.); }`,'questions slide') } }, draw(s,d,r){ const v=d.view, E=d.E, L=E.lin, c=d.ctx2d; const cx=(v.x0+v.x1)/2, cy=(v.y0+v.y1)/2; const tilt=s.k(2,7,8.5,E.io3); const ang=0.0174533*tilt, sc=1-.08*tilt; const U=r.U; U.uC[0]=cx; U.uC[1]=cy; U.uH[0]=v.w/2; U.uH[1]=v.h/2; U.uA=ang; U.uS=sc; r.bg.draw(U); c.save(); c.translate(cx,cy); c.rotate(ang); c.scale(sc,sc); c.translate(-cx,-cy); d.text('Any questions?',{x:cx,y:410,size:110,font:'arial',color:'#000',align:'center',style:'fade'}); const t1=s.k(1,.8,2.2,L), del=s.k(2,0,.8,L), t2=s.k(2,1,2.6,L); const n2=Math.round(t2*r.q2.length); let line, typing; if(n2>0){ line=r.q2.slice(0,n2); typing=t2<1; } else { line=r.q1.slice(0,Math.round(t1*(1-del)*r.q1.length)); typing=(t1>0&&t1<1)||(del>0&&del<1)||(del>=1); } const tb=d.text(line,{x:cx,y:622,size:64,font:'arial',color:'#000',align:'center',show:1}); const boxA=s.k(1,.1,.7,L); const grow=s.k(2,3,4.5,E.io3); if(boxA>0){ const blink=typing||Math.sin(s.t*6.5)>0; if(blink){ const cxr=line.length?tb.x+tb.w+4:cx-2; d.rect(cxr,624,4,66,'#000',boxA); } const br=4*Math.sin(s.t*1.6)*grow; const sx=cx-400, sy=596, sw=800, sh=110; const bx=v.x0+50+br, by=v.y0+50+br, bw=v.w-100-2*br, bh=v.h-100-2*br; d.select(sx+(bx-sx)*grow, sy+(by-sy)*grow, sw+(bw-sw)*grow, sh+(bh-sh)*grow,{a:boxA}); } c.restore(); } });