Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

17.6 KB
Raw Blame
<!doctype html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Notch Buddy · coucou d'entrée v2 (référence)</title>
<style>
:root{box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);
  --bg:#E2E4E8;--ink:#16171B;--muted:#5F646D;--panel:#fff;--line:#D1D4DA}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){--bg:#131417;--ink:#ECEDEF;--muted:#9A9FA8;--panel:#1E2024;--line:#32353B}}
:root[data-theme="dark"]{--bg:#131417;--ink:#ECEDEF;--muted:#9A9FA8;--panel:#1E2024;--line:#32353B}
*,*::before,*::after{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif}
.wrap{max-width:1000px;margin:0 auto;padding:26px 20px 40px}
h1{margin:0;font-size:24px;letter-spacing:-.02em}
p{margin:6px 0 16px;color:var(--muted);font-size:14px;line-height:1.45;max-width:74ch}
.stage{background:#07080A;border-radius:18px;overflow:hidden}
canvas{display:block;width:100%;height:auto}
.bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:14px}
button{appearance:none;border:1px solid var(--line);background:var(--panel);color:var(--ink);border-radius:999px;padding:8px 14px;font:inherit;font-size:13.5px;cursor:pointer}
button.on{background:var(--ink);color:var(--panel);border-color:var(--ink)}
input[type=range]{flex:1;min-width:200px}
.t{font-family:"SF Mono",ui-monospace,Menlo,monospace;font-size:13px;min-width:150px}
.phase{font-size:14px;font-weight:600;min-width:300px}
</style>
</head>
<body>
<div class="wrap">
  <h1>Coucou d'entrée v2, avec le Mochi de Louis</h1>
  <p>Tout est une fonction du temps et de l'instant où la souris quitte le notch. Repère de l'island, en points. « Souris sur le notch » : le coucou se termine et l'island reste ouverte. « Retirer la souris » : l'island se replie en petit tout de suite, même en pleine animation.</p>
  <div class="stage"><canvas id="c" width="1280" height="440"></canvas></div>
  <div class="bar">
    <button id="play" class="on">Pause</button>
    <button id="restart">Recommencer</button>
    <button id="slow">Ralenti ×4</button>
    <button id="hover">Souris sur le notch</button>
    <button id="leave">Retirer la souris maintenant</button>
    <button id="snd">Son</button>
    <span class="t" id="t">t = 0.000 s</span>
  </div>
  <div class="bar"><input type="range" id="scrub" min="0" max="6.4" step="0.001" value="0"><span class="phase" id="phase"></span></div>
</div>
<script>
(()=>{
/* ====================== CONSTANTES (repère island, points) ====================== */
const W=640, H=220, CX=320;
const NOTCH={w:184,h:32};
const BIG={w:640,h:150};                  // island ouverte pendant le coucou
const SMALL={w:NOTCH.w+104,h:32};         // « petit » : notch + les deux oreilles
const CARD={x:10,y:36,w:620,h:104,r:20};
const C0={x:320,y:90};                    // centre du Mochi pendant le coucou
const HB=58;                              // hauteur du corps du Mochi pendant le coucou
const ASPECT=1.34;                        // largeur / hauteur du Mochi de Louis
const EAR={x:27,y:16,hb:17};              // Mochi dans l'oreille gauche du petit
const MINI=['#E86A6A','#3E86E0','#EFAE5A','#8C73F2'];
const T={grow:.45, squint0:.60, squint1:.82, dip0:1.25, dip1:1.40, pop0:1.36, pop1:1.52, waveEnd:2.45, content0:2.45, content1:2.58,
  tuck0:2.58, tuck1:2.80, badge:2.72, down0:2.85, down1:3.20, blink2:3.80, tint0:3.85, tint1:4.15, end:4.60, autoLeave:4.90};
const COLLAPSE=.34;                        // durée du repli en petit

/* ====================== OUTILS ====================== */
const clamp=(v,a,b)=>Math.max(a,Math.min(b,v)), lerp=(a,b,t)=>a+(b-a)*t, seg=(t,a,b)=>clamp((t-a)/(b-a),0,1);
const E={out:t=>1-Math.pow(1-t,3),in:t=>t*t*t,inOut:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2,
  back:t=>{const c1=1.70158,c3=c1+1;return 1+c3*Math.pow(t-1,3)+c1*Math.pow(t-1,2)}};
let seed=7; const rnd=()=>{ seed=(seed*1103515245+12345)&0x7fffffff; return seed/0x7fffffff };
const RINGS=[.10,.20,.30,.45,.60].map(t0=>({t0,dots:Array.from({length:170},()=>({a:rnd()*Math.PI*2,j:(rnd()-.5)*.22,s:.7+rnd()*.9,al:.45+rnd()*.55}))}));
const STREAKS=Array.from({length:16},(_,i)=>({a:(i/16)*Math.PI*2+(rnd()-.5)*.3,sp:230+rnd()*260,len:6+rnd()*9,t0:.08+rnd()*.14,col:['#3B9EFF','#F29B38','#FF5A4E','#2EC4A0','#A78BFA'][i%5]}));

/* ====================== POSE DU COUCOU À L'INSTANT t ====================== */
function greetPose(t){
  const p={};
  // island du notch vers la grande taille (0 → 0,5 s, léger dépassement)
  const gx=seg(t,0,.5), g=Math.sin(Math.PI*gx/2)+.04*Math.sin(Math.PI*gx)*gx;
  p.iw=lerp(NOTCH.w,BIG.w,g); p.ih=lerp(NOTCH.h,BIG.h,g); p.ir=lerp(12,30,clamp(g,0,1)); p.header=seg(t,.35,.6); p.card=seg(t,.18,.45);
  // corps : naît minuscule au centre du notch et grandit
  const gg=E.back(seg(t,.02,T.grow)); p.hb=lerp(3,HB,gg); p.x=C0.x; p.y=lerp(16,C0.y,E.out(seg(t,.02,T.grow)));
  p.sx=1; p.sy=1; p.tilt=0;
  // plongeon en avant (1,25 → 1,40) : le corps descend, s'écrase, les yeux roulent vers le bas et disparaissent
  if(t>=T.dip0&&t<T.pop1){ const k=Math.sin(Math.PI*seg(t,T.dip0,T.pop1)); p.y+=p.hb*.22*k; p.sy=1-.06*k; p.sx=1+.04*k }
  // coucou : le corps se balance de gauche à droite et penche un peu
  if(t>=T.pop1&&t<T.tuck1){ const w=t-T.pop1, fade=1-seg(t,T.tuck0,T.tuck1); p.x+=Math.sin(w*2*Math.PI*.9)*p.hb*ASPECT*.05*fade; p.tilt=(Math.sin(w*2*Math.PI*.9+.6)*.05)*fade; p.y+=Math.sin(w*2*Math.PI*1.8)*.8*fade }
  // il se tasse vers le bas quand les mains rentrent, puis revient
  if(t>=T.tuck0&&t<T.down1){ const k=Math.sin(Math.PI*seg(t,T.tuck0,T.down1)); p.y+=p.hb*.12*k }
  // yeux (points)
  p.eye='dot'; p.open=1; p.eyeRoll=0;
  if(t>=T.squint0&&t<T.squint1) p.eye='happy';
  if(t>=T.content0&&t<T.content1) p.eye='content';
  if(t>=T.down0&&t<T.down1) p.eye='content';
  if(t>=T.dip0&&t<T.pop1){ p.eyeRoll=Math.sin(Math.PI*seg(t,T.dip0,T.pop1)) }      // 0 → 1 → 0 : les yeux glissent vers le bas et sortent du corps
  const blink=tb=>{ const k=seg(t,tb,tb+.12); return k>0&&k<1?1-Math.sin(Math.PI*k)*.94:1 }; p.open=Math.min(blink(1.95),blink(T.blink2));
  // regard (-1..1)
  p.lookX=0; p.lookY=0;
  if(t>=T.squint1&&t<T.dip0){ p.lookY=-.2 }
  if(t>=T.pop1&&t<T.content0){ p.lookX=.55; p.lookY=-.45 }                 // regarde Louis, en haut à droite
  if(t>=T.content0&&t<T.down1){ p.lookX=-.3; p.lookY=.6 }
  if(t>=T.down1){ const k=E.inOut(seg(t,T.down1,T.down1+.35)); p.lookX=lerp(-.3,0,k); p.lookY=lerp(.6,0,k) }
  // mains : 0 = cachées sous le corps, 1 = sorties
  p.handL=t<T.tuck0?E.back(seg(t,T.pop0,T.pop0+.14)):1-E.in(seg(t,T.tuck0,T.tuck1-.03));
  p.handR=t<T.tuck0?E.back(seg(t,T.pop0+.04,T.pop0+.18)):1-E.in(seg(t,T.tuck0+.03,T.tuck1));
  p.wave=t>=T.pop1&&t<T.tuck0?(t-T.pop1):-1;
  // badge et teinte : SEULEMENT si une tâche tourne (ici oui, pour montrer)
  p.badge=E.back(seg(t,T.badge,T.badge+.28)); p.tint=.6*E.inOut(seg(t,T.tint0,T.tint1));
  p.halo=E.out(seg(t,.3,.7)); p.haloBlue=seg(t,T.tint0,T.tint1);
  p.minis=0;
  return p;
}
/* pose du « petit » */
function smallPose(){ return {iw:SMALL.w,ih:SMALL.h,ir:14,header:0,card:0,hb:EAR.hb,x:CX-SMALL.w/2+EAR.x,y:EAR.y,sx:1,sy:1,tilt:0,eye:'dot',open:1,eyeRoll:0,lookX:0,lookY:0,handL:0,handR:0,wave:-1,badge:1,tint:.6,halo:.6,haloBlue:1,minis:1} }
/* pose finale à l'instant t, avec repli déclenché à tc (tc = Infinity si la souris reste) */
function pose(t,tc){
  if(t<tc) return greetPose(Math.min(t,T.end+10));
  const a=greetPose(tc), b=smallPose(), k=seg(t,tc,tc+COLLAPSE), e=E.inOut(k);
  const p={...a};
  for(const key of ['iw','ih','ir','x','y','hb','badge','tint','halo','haloBlue']) p[key]=lerp(a[key],b[key],e);
  p.header=a.header*(1-seg(t,tc,tc+.1)); p.card=a.card*(1-seg(t,tc,tc+.18));
  p.handL=a.handL*(1-seg(t,tc,tc+.15)); p.handR=a.handR*(1-seg(t,tc,tc+.15)); p.wave=a.wave>=0?a.wave:-1;
  p.tilt=a.tilt*(1-e); p.sx=lerp(a.sx,1,e); p.sy=lerp(a.sy,1,e); p.eyeRoll=a.eyeRoll*(1-e);
  const bk=seg(t,tc+.14,tc+.26); p.eye='dot'; p.open=bk>0&&bk<1?1-Math.sin(Math.PI*bk)*.94:1;   // clignement pendant le trajet
  p.lookX=a.lookX*(1-e); p.lookY=a.lookY*(1-e);
  p.minis=E.back(seg(t,tc+.24,tc+.42));
  p.fx=1-seg(t,tc,tc+.2);                  // particules restantes qui s'éteignent
  return p;
}

/* ====================== DESSIN ====================== */
const cv=document.getElementById('c'), X=cv.getContext('2d'), K=cv.width/W;
function rr(a,b,w,h,r){r=Math.max(0,Math.min(r,w/2,h/2));X.beginPath();X.moveTo(a+r,b);X.arcTo(a+w,b,a+w,b+h,r);X.arcTo(a+w,b+h,a,b+h,r);X.arcTo(a,b+h,a,b,r);X.arcTo(a,b,a+w,b,r);X.closePath()}
function mochiPath(hw,hh){ const n=3.2, p=new Path2D(); for(let i=0;i<=96;i++){ const a=i/96*Math.PI*2, ca=Math.cos(a), sa=Math.sin(a); const px=hw*Math.sign(ca)*Math.pow(Math.abs(ca),2/n), py=hh*Math.sign(sa)*Math.pow(Math.abs(sa),2/n); i?p.lineTo(px,py):p.moveTo(px,py) } p.closePath(); return p }
const WHITE0='#FBFBFC', WHITE1='#E7E9EC';
function whiteFill(x0,y0,x1,y1){ const g=X.createLinearGradient(x0,y0,x1,y1); g.addColorStop(0,WHITE0); g.addColorStop(1,WHITE1); return g }
function drawHandL(p,hw,hh){ // main gauche : petite boule Ø 0,30 × hauteur du corps
  const k=p.handL; if(k<=.01) return; const hb=hh*2, r=hb*.15*k;
  const rest={x:-hw-hb*.22, y:hh*.62}, hide={x:-hw*.35, y:hh*.85};
  let x=lerp(hide.x,rest.x,k), y=lerp(hide.y,rest.y,k);
  if(p.wave>=0) y+=Math.sin(p.wave*6)*hb*.02;                      // petit balancement
  X.save(); X.translate(x,y); X.fillStyle=whiteFill(r,-r,-r,r); X.beginPath(); X.arc(0,0,r,0,Math.PI*2); X.fill();
  X.strokeStyle='rgba(0,0,0,.08)'; X.lineWidth=.8; X.stroke(); X.restore() }
function drawHandR(p,hw,hh){ // main droite : capsule 0,40 × 0,22 × hauteur du corps, penchée vers le haut, qui s'agite
  const k=p.handR; if(k<=.01) return; const hb=hh*2, L=hb*.40*k, T2=hb*.22*k;
  const rest={x:hw+hb*.20, y:hh*.20}, hide={x:hw*.35, y:hh*.85};
  let x=lerp(hide.x,rest.x,k), y=lerp(hide.y,rest.y,k), ang=-0.61;   // −35°
  if(p.wave>=0){ const w=p.wave*2*Math.PI*2.5; ang+=Math.sin(w)*.21; y+=Math.sin(w+.8)*hb*.04; x+=Math.cos(w)*hb*.015 }
  X.save(); X.translate(x,y); X.rotate(ang); X.fillStyle=whiteFill(L/2,-T2/2,-L/2,T2/2); rr(-L/2,-T2/2,L,T2,T2/2); X.fill();
  X.strokeStyle='rgba(0,0,0,.08)'; X.lineWidth=.8; X.stroke(); X.restore() }
function drawMochi(p){
  const hh=p.hb/2, hw=hh*ASPECT; if(hh<.4) return;
  // halo doré puis bleu
  if(p.halo>0){ const c=[lerp(232,59,p.haloBlue),lerp(195,158,p.haloBlue),lerp(154,255,p.haloBlue)].map(v=>v|0); const R=hw*2.4; const hg=X.createRadialGradient(p.x,p.y,hh*.3,p.x,p.y,R); hg.addColorStop(0,`rgba(${c},${.36*p.halo})`); hg.addColorStop(1,`rgba(${c},0)`); X.fillStyle=hg; X.beginPath(); X.arc(p.x,p.y,R,0,Math.PI*2); X.fill() }
  X.save(); X.translate(p.x,p.y); X.rotate(p.tilt); X.scale(p.sx,p.sy);
  // mains DERRIÈRE le corps
  drawHandL(p,hw,hh); drawHandR(p,hw,hh);
  const path=mochiPath(hw,hh);
  X.fillStyle=whiteFill(hw*.6,-hh,-hw*.6,hh); X.fill(path);
  if(p.tint>0){ const tg=X.createLinearGradient(0,hh,0,-hh*.1); tg.addColorStop(0,`rgba(127,180,234,${p.tint})`); tg.addColorStop(1,'rgba(127,180,234,0)'); X.fillStyle=tg; X.fill(path) }
  // yeux : deux points, écart 0,38 × hauteur, un peu sous le centre
  X.save(); X.clip(path); X.fillStyle='#16171A'; X.strokeStyle='#16171A';
  const er=p.hb*.06, sp=p.hb*.19, lx=p.lookX*hw*.42, ly=p.lookY*hh*.28+hh*.12+p.eyeRoll*hh*1.25;
  for(const sd of[-1,1]){ X.save(); X.translate(sd*sp+lx,ly);
    if(p.eye==='happy'||p.eye==='content'){ X.lineWidth=er*.95; X.lineCap='round'; X.beginPath(); if(p.eye==='happy') X.arc(0,er*.6,er*1.25,Math.PI*1.15,Math.PI*1.85); else X.arc(0,-er*.5,er*1.25,Math.PI*.15,Math.PI*.85); X.stroke() }
    else { X.scale(1,Math.max(.12,p.open)); X.beginPath(); X.arc(0,0,er,0,Math.PI*2); X.fill() }
    X.restore() }
  X.restore();
  // badge « travaille »
  if(p.badge>.01){ X.save(); X.translate(-hw*.78,-hh*.72); X.scale(p.badge,p.badge); const br=hh*.3; X.fillStyle='#000'; X.beginPath(); X.arc(0,0,br+hh*.07,0,Math.PI*2); X.fill(); X.fillStyle='#3BA0F5'; X.beginPath(); X.arc(0,0,br,0,Math.PI*2); X.fill();
    for(let i=0;i<3;i++){ X.fillStyle='#0B1B3A'; X.beginPath(); X.arc((i-1)*br*.5,0,br*.17,0,Math.PI*2); X.fill() } X.restore() }
  X.restore() }
function draw(t,tc){
  const p=pose(t,tc);
  X.setTransform(K,0,0,K,0,0); X.clearRect(0,0,W,H); X.fillStyle='#0B0D12'; X.fillRect(0,0,W,H);
  const ix=CX-p.iw/2; X.fillStyle='#000'; X.beginPath(); X.moveTo(ix,0); X.lineTo(ix+p.iw,0); X.lineTo(ix+p.iw,p.ih-p.ir); X.quadraticCurveTo(ix+p.iw,p.ih,ix+p.iw-p.ir,p.ih); X.lineTo(ix+p.ir,p.ih); X.quadraticCurveTo(ix,p.ih,ix,p.ih-p.ir); X.closePath(); X.fill();
  // notch physique (repère)
  X.fillStyle='#050506'; rr(CX-NOTCH.w/2,-12,NOTCH.w,NOTCH.h+12,12); X.fill();
  X.save(); X.beginPath(); X.rect(ix,0,p.iw,Math.max(p.ih,40)); X.clip();
  if(p.card>0){ X.save(); X.globalAlpha=p.card; X.fillStyle='#141518'; rr(CARD.x,CARD.y,CARD.w,CARD.h,CARD.r); X.fill(); X.restore()
    X.save(); rr(CARD.x,CARD.y,CARD.w,CARD.h,CARD.r); X.clip(); const fx=p.fx===undefined?1:p.fx;
    for(const ring of RINGS){ const k=seg(t,ring.t0,ring.t0+1.35); if(k<=0||k>=1) continue; const rx=lerp(14,380,E.out(k)), ry=rx*.34, fade=(1-k)*(k<.08?k/.08:1)*fx*p.card;
      for(const d of ring.dots){ const r=1+d.j; X.fillStyle=`rgba(255,255,255,${d.al*fade})`; X.fillRect(C0.x+Math.cos(d.a)*rx*r,C0.y+Math.sin(d.a)*ry*r,d.s,d.s) } }
    for(const s of STREAKS){ const k=seg(t,s.t0,s.t0+.6); if(k<=0||k>=1) continue; const dist=s.sp*E.out(k)*.9+10;
      X.strokeStyle=s.col; X.globalAlpha=(1-k)*fx; X.lineWidth=1.6; X.lineCap='round'; X.beginPath(); X.moveTo(C0.x+Math.cos(s.a)*(dist-s.len),C0.y+Math.sin(s.a)*(dist-s.len)*.42); X.lineTo(C0.x+Math.cos(s.a)*dist,C0.y+Math.sin(s.a)*dist*.42); X.stroke(); X.globalAlpha=1 }
    X.restore() }
  if(p.header>0){ X.save(); X.globalAlpha=p.header; X.fillStyle='#1D1F23'; rr(18,4,44,26,13); X.fill(); X.fillStyle='#F5F6F8'; X.beginPath(); X.moveTo(33,20); X.lineTo(40,13); X.lineTo(47,20); X.lineTo(47,25); X.lineTo(33,25); X.fill();
    X.fillStyle='#8E939C'; X.beginPath(); X.arc(82,17,6.5,0,Math.PI*2); X.fill(); X.beginPath(); X.arc(578,17,6,0,Math.PI*2); X.fill(); X.fillStyle='#000'; X.beginPath(); X.arc(578,17,2.4,0,Math.PI*2); X.fill(); X.restore() }
  // mini-Mochis de l'oreille droite
  if(p.minis>.01){ const cx=CX+SMALL.w/2-27, cy=16, sp=6; [[-sp,-sp],[sp,-sp],[-sp,sp],[sp,sp]].forEach(([dx,dy],i)=>{ X.save(); X.translate(cx+dx,cy+dy); X.scale(p.minis,p.minis); X.fillStyle=MINI[i]; X.fill(mochiPath(5.3,4)); X.restore() }) }
  drawMochi(p);
  X.restore();
  const ph=t>=tc?'Repli en petit (souris partie)':t<T.grow?'1 · Le notch s\u2019ouvre, le Mochi jaillit':t<T.dip0?'2 · Ondes, yeux plissés de joie, il te regarde':t<T.pop1?'3 · Plongeon en avant, les mains sortent de sous le corps':t<T.tuck0?'4 · COUCOU : main droite qui s\u2019agite, main gauche posée':t<T.tuck1?'5 · Les mains rentrent sous le corps':t<T.down1?'6 · Il se tasse, yeux contents, le badge apparaît':t<T.end?'7 · Clignement, teinte de l\u2019état':'8 · Fin du coucou : reste ouvert tant que la souris est là';
  return ph;
}

/* ====================== LECTURE ====================== */
const Snd={on:false,ctx:null,init(){ if(this.ctx)return; const C=window.AudioContext||window.webkitAudioContext; if(!C)return; this.ctx=new C(); this.g=this.ctx.createGain(); this.g.gain.value=.7; this.g.connect(this.ctx.destination) },
  tone(f,to,d,g,delay=0){ const c=this.ctx,t=c.currentTime+delay,o=c.createOscillator(),n=c.createGain(); o.frequency.setValueAtTime(f,t); if(to)o.frequency.exponentialRampToValueAtTime(to,t+d*.9); n.gain.setValueAtTime(.0001,t); n.gain.exponentialRampToValueAtTime(g,t+.006); n.gain.exponentialRampToValueAtTime(.0001,t+d); o.connect(n); n.connect(this.g); o.start(t); o.stop(t+d+.05) },
  cue(n){ if(!this.on)return; this.init(); if(!this.ctx)return; if(this.ctx.state==='suspended')this.ctx.resume();
    if(n==='open'){ this.tone(300,560,.24,.06); [1568,1976,2349].forEach((f,i)=>this.tone(f,0,.5,.018,.06+i*.05)) }
    if(n==='greet'){ [523.25,659.25,783.99].forEach((f,i)=>this.tone(f,0,.32,.06,i*.085)) }
    if(n==='blip') this.tone(1480,0,.07,.035); if(n==='close'){ this.tone(520,300,.2,.05) } } };
const CUES=[[0,'open'],[T.pop0,'greet'],[T.badge,'blip']];
let t=0, playing=true, slow=1, hover=false, tc=T.autoLeave, last=performance.now();
const $=id=>document.getElementById(id);
function loop(now){ const dt=Math.min(.05,(now-last)/1000); last=now; const prev=t;
  if(playing){ t+=dt/slow; if(t>Math.min(tc,T.end+1.2)+1.2&&(tc!==Infinity||t>T.end+1.5)){ if(tc!==Infinity){ t=0; tc=hover?Infinity:T.autoLeave } else t=T.end+1.5 }
    for(const [ct,n] of CUES) if(prev<ct&&t>=ct&&t<tc) Snd.cue(n); if(prev<tc&&t>=tc) Snd.cue('close') }
  const ph=draw(t,tc); $('t').textContent='t = '+t.toFixed(3)+' s'; $('phase').textContent=ph; $('scrub').value=t; requestAnimationFrame(loop) }
$('play').onclick=()=>{ playing=!playing; $('play').textContent=playing?'Pause':'Lecture'; $('play').classList.toggle('on',playing) };
$('restart').onclick=()=>{ t=0; tc=hover?Infinity:T.autoLeave; playing=true; $('play').textContent='Pause'; $('play').classList.add('on') };
$('slow').onclick=()=>{ slow=slow===1?4:1; $('slow').classList.toggle('on',slow===4) };
$('hover').onclick=()=>{ hover=!hover; $('hover').classList.toggle('on',hover); if(hover&&t<tc) tc=Infinity };
$('leave').onclick=()=>{ hover=false; $('hover').classList.remove('on'); if(t<tc) tc=t };
$('snd').onclick=()=>{ Snd.on=!Snd.on; if(Snd.on)Snd.init(); $('snd').classList.toggle('on',Snd.on) };
$('scrub').oninput=e=>{ t=+e.target.value; playing=false; $('play').textContent='Lecture'; $('play').classList.remove('on') };
window.__draw=(tt,tcc=T.autoLeave)=>{ t=tt; tc=tcc; playing=false; return draw(tt,tcc) };
requestAnimationFrame(loop);
})();
</script>
</body>
</html>