Deck.transition('portal-out',{dur:1.2,frag:`void main(){ vec2 q=vUv-.5; q.x*=uRes.x/uRes.y; float e=smoothstep(0.,1.,p); float sc=mix(.35,1.,e); vec2 uvB=(vUv-.5)*sc+.5; float r=max(abs(q.x)/(uRes.x/uRes.y),abs(q.y))*2.; float edge=mix(.02,1.6,e); float m=smoothstep(edge,edge-.06,r*1.0); vec4 a=texture(tA,vUv); vec4 b=texture(tB,vUv); vec4 b2=texture(tB,clamp(uvB,0.,1.)); vec4 inner=mix(a*(1.-.5*e),b2,sat(e*1.4)); vec4 c=mix(a*(1.-.4*e),mix(b2,b,e),m); o=mix(c,b,smoothstep(.85,1.,p)); o=mix(a,o,smoothstep(0.,.04,p)); if(p>=.999)o=b; if(p<=.001)o=a; }`}); Deck.scene({ id:'questions', title:'Any questions?', enterWith:'portal-out', post:{tone:'none'}, beats:[{dur:1,hold:4},{dur:3.2,hold:4},{dur:9,hold:5}], 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(`uniform float uT; void main(){ vec2 q=design(vUv); vec2 c=q-vec2(960.,540.); float v=1.-.5*smoothstep(300.,1300.,length(c)); vec3 dark=vec3(.05,.055,.07)*v+.02*fbm(q*.01); o=vec4(mix(vec3(1.),dark,uT),1.); }`,'questions bg') } }, draw(s,d,r){ const E=d.E, c=d.ctx2d; const tilt=s.k(2,5,7.5,E.io3); r.bg.draw({uT:tilt}); const breathe=1+.004*Math.sin(s.t*1.8)*s.k(2,3.6,4.4); const sc=1-.05*tilt; c.save(); c.translate(960,540); c.rotate(tilt*Math.PI/180); c.scale(sc,sc); c.translate(-960,-540); if(tilt>0){ c.save(); c.globalAlpha=.45*tilt; c.fillStyle='#000'; c.filter='blur(30px)'; c.fillRect(-20+0,30,1960,1100); c.restore(); c.filter='none'; } d.rect(0,0,1920,1080,'#ffffff'); d.rect(0,1062,1920,18,'#2f6fd6'); d.text('Any questions?',{x:960,y:380,size:110,font:'arial',color:'#000',align:'center',style:'fade'}); const blink=Math.sin(s.t*6)>0?1:0; const full1='I have one.', full2='What do you want?'; let line='', showCur=0; if(s.beat===0){ line=''; } else if(s.beat===1){ line=full1.slice(0,Math.round(s.k(1,.8,2.2,E.lin)*full1.length)); showCur=1; } else { const del=s.k(2,0,.8,E.lin), ty=s.k(2,1,2.8,E.lin); if(ty>0) line=full2.slice(0,Math.round(ty*full2.length)); else line=full1.slice(0,Math.round((1-del)*full1.length)); showCur=1; } const sel1=s.k(1,.2,.9,E.lin); const grow=s.k(2,3.2,4.4,E.io3); const full=d.text(full2,{x:960,y:600,size:72,font:'arial',align:'center',show:0}); const t=d.text(line,{x:960,y:600,size:72,font:'arial',color:'#000',align:'center',show:1}); if(showCur&&blink) d.rect(line.length?t.x+t.w+6:960,full.y,6,full.h,'#000'); const bx=full.x-30, by=full.y-30, bw=full.w+60, bh=full.h+60; const tx=36,ty2=60,tw=1920-72,th=1080-120-20; const g=grow; const a=Math.max(sel1,0)*(s.beat>=1?1:0); const w=bw+(tw-bw)*g, h=bh+(th-bh)*g, x=bx+(tx-bx)*g, y=by+(ty2-by)*g; const br=g>=1?1+0*breathe:1; if(a>0){ const cx=x+w/2, cy=y+h/2, k=g>.99?breathe:1; d.select(cx-w*k/2,cy-h*k/2,w*k,h*k,{a:a}); } c.restore(); } });