Skip to content

Private AI meeting notes that stay on your computer. No meeting bot. Free and open source for Mac, Windows and Linux. An alternative to Granola, Otter and Fireflies.

Site: the hero ribbons come in as the app window turns solid, not after it

Eric Brownroutb1c3d778c26e
diff --git a/site/public/marketing/hero-entry.mjs b/site/public/marketing/hero-entry.mjs
index 5464a52e..a983d4ff 100644
--- a/site/public/marketing/hero-entry.mjs
+++ b/site/public/marketing/hero-entry.mjs
@@ -29,6 +29,17 @@ function layoutRibbons(){
}
const resize=new ResizeObserver(layoutRibbons);
resize.observe(svg);resize.observe(product);layoutRibbons();
+let cover=null;
+function coverWindow(){
+ if(!cover)return;
+ const a=product.getBoundingClientRect(),b=svg.getBoundingClientRect();
+ // A root SVG clip uses viewport pixels, not its stretched viewBox coordinates.
+ // Keep the cutout inside the window border so antialiasing never exposes a page-colored seam.
+ const x=a.left-b.left+1,y=a.top-b.top+1,r=a.right-b.left-1,d=a.bottom-b.top-1;
+ const radius=Math.max(0,parseFloat(getComputedStyle(product).borderTopLeftRadius)-1),rx=radius,ry=radius;
+ cover.setAttribute('d',`M-2 -2H${b.width+2}V${b.height+2}H-2Z M${x+rx} ${y}H${r-rx}Q${r} ${y} ${r} ${y+ry}V${d-ry}Q${r} ${d} ${r-rx} ${d}H${x+rx}Q${x} ${d} ${x} ${d-ry}V${y+ry}Q${x} ${y} ${x+rx} ${y}Z`);
+}
+function makeCover(){const ns='http://www.w3.org/2000/svg',clip=document.createElementNS(ns,'clipPath');clip.id='ribbon-window-cover';clip.setAttribute('clipPathUnits','userSpaceOnUse');cover=document.createElementNS(ns,'path');cover.setAttribute('clip-rule','evenodd');clip.append(cover);svg.querySelector('defs').append(clip);svg.setAttribute('clip-path','url(#ribbon-window-cover)');coverWindow();restore.push(()=>{svg.removeAttribute('clip-path');clip.remove();cover=null})}
function complete(){
if(completed) return;
completed=true;
@@ -67,7 +78,8 @@ else{
const background='ribbon';
if(background==='ribbon'){
const surface=svg.querySelector('#ribbon-surface');
- const ribbonStart=windowDelay+fadeDuration,bandDuration=350,bandStagger=55;
+ const ribbonStart=windowDelay,bandDuration=350,bandStagger=55;
+ makeCover();
const bands=[...svg.querySelectorAll('[data-ribbon-band]')].map((band,index)=>{
const paths=[...band.querySelectorAll('path')];
const seam=svg.querySelector(`#ribbon-seam-${index+1}`);
@@ -90,7 +102,7 @@ else{
});
paintRibbons();
// A seekable clock drives d attributes, not a transform or clipping wipe.
- // It starts only after the live window has painted.
+ // Entry starts with the app becoming opaque, after its renderer is ready.
const clock=svg.animate([],{duration:ribbonStart+4*bandStagger+bandDuration,fill:'backwards'});
animations.push(clock);
function draw(){
@@ -102,11 +114,13 @@ else{
const length=coveredLength+(1-coveredLength)*(1-(1-progress)**3);
geometry.forEach(part=>part.progress=length);
});
- paintRibbons();
+ paintRibbons();coverWindow();
if(!completed) frame=requestAnimationFrame(draw);
}
frame=requestAnimationFrame(draw);
}
+ // Keep the app demo and idle motion on their existing schedule.
+ animations.push(svg.animate([],{duration:windowDelay+fadeDuration+4*55+350}));
Promise.all(animations.map(animation=>animation.finished)).then(complete).catch(()=>{});
reduceMotion.addEventListener('change',event=>{
if(!event.matches) return;
diff --git a/site/scripts/hero-entry.test.mjs b/site/scripts/hero-entry.test.mjs
index 71705297..d0d0bd0f 100644
--- a/site/scripts/hero-entry.test.mjs
+++ b/site/scripts/hero-entry.test.mjs
@@ -44,11 +44,11 @@ vm.runInNewContext(ribbons,{
console.log('Static preview and reduced motion settle entry without starting ribbon animations.')
// Exercise the real entry clock and cleanup without a browser or native app.
-for(const width of [1280,1728,2560]){
- const dataset={heroEntry:'pending'},animations=[],listeners=[],events=[],materials=[]
+for(const width of [390,1280,1728,2560]){
+ const dataset={heroEntry:'pending'},animations=[],listeners=[],events=[],materials=[],created=[],windowListeners=new Map()
let draw,onResize,viewport=width
const node=attributes=>({attributes,getAttribute(name){return this.attributes[name]},setAttribute(name,value){this.attributes[name]=value},
- after(){},remove(){this.removed=true},cloneNode(){const copy=node({...this.attributes});materials.push(copy);return copy},
+ removeAttribute(name){delete this.attributes[name]},append(...children){this.children=children},after(){},remove(){this.removed=true},cloneNode(){const copy=node({...this.attributes});materials.push(copy);return copy},
animate(frames,options){let finish;const animation={frames,currentTime:0,options,finished:new Promise(resolve=>finish=resolve),finish:()=>finish(),cancel(){}};animations.push(animation);return animation}})
const bands=Array.from({length:5},(_,i)=>{
const d=`M0 ${i*130} 800 325 0 ${(i+1)*130}Z`
@@ -57,31 +57,62 @@ for(const width of [1280,1728,2560]){
})
const seams=Array.from({length:4},(_,i)=>node({d:`M0 ${(i+1)*130} 800 325`}))
const paths=[...bands.flatMap(band=>band.paths),...seams],originals=paths.map(path=>path.attributes.d)
- const product={...node({}),dataset:{live:'true'},getBoundingClientRect:()=>({width:Math.min(viewport*.76,1200),height:Math.min(viewport*.76,1200)*.608})}
- const svg={...node({}),getBoundingClientRect:()=>({width:viewport,height:Math.min(viewport,1728)*.4256}),
+ const appWidth=()=>viewport<=760?viewport-40:Math.min(viewport*.76,1200)
+ const appHeight=()=>viewport<=760?532:appWidth()*.608
+ const ribbonHeight=()=>viewport<=760?532:Math.min(viewport,1728)*.4256
+ const product={...node({}),dataset:{live:width===1280?'false':'true'},getBoundingClientRect:()=>({left:(viewport-appWidth())/2,top:120,right:(viewport+appWidth())/2,bottom:120+appHeight(),width:appWidth(),height:appHeight()})}
+ const defs=node({})
+ const svg={...node({}),getBoundingClientRect:()=>({left:0,top:100,width:viewport,height:ribbonHeight()}),
querySelectorAll:selector=>selector==='defs path'?paths:selector==='[data-ribbon-band]'?bands:[],
- querySelector:selector=>selector.startsWith('#ribbon-seam-')?seams[Number(selector.at(-1))-1]:node({})}
+ querySelector:selector=>selector==='defs'?defs:selector.startsWith('#ribbon-seam-')?seams[Number(selector.at(-1))-1]:node({})}
const reduced={matches:false,addEventListener:(_name,callback)=>listeners.push(callback)}
- await vm.runInNewContext(`(async()=>{${entry}})()`,{
+ const execution=vm.runInNewContext(`(async()=>{${entry}})()`,{
URLSearchParams,Event,location:{search:''},ribbonGeometry,ribbonPath,
- matchMedia:query=>query.includes('reduce')?reduced:{matches:true},
- document:{documentElement:{dataset},querySelector:selector=>selector==='.signal-wings'?svg:selector==='.product-window'?product:node({})},
- window:{dispatchEvent:event=>events.push(event.type)},
+ matchMedia:query=>query.includes('reduce')?reduced:{matches:width>760,addEventListener(){}},
+ getComputedStyle:()=>({borderTopLeftRadius:'14px'}),
+ document:{documentElement:{dataset},createElementNS(_ns,tag){const element=node({});element.tag=tag;created.push(element);return element},querySelector:selector=>selector==='.signal-wings'?svg:selector==='.product-window'?product:node({})},
+ window:{dispatchEvent:event=>events.push(event.type),addEventListener:(name,callback)=>windowListeners.set(name,callback)},
ResizeObserver:class{constructor(callback){onResize=callback}observe(){}},
requestAnimationFrame:callback=>{draw=callback;return 1},cancelAnimationFrame(){draw=null},
})
- const clock=animations.at(-1)
+ if(width===1280){
+ assert.equal(draw,undefined,'no ribbon drawing before the renderer is ready')
+ assert.equal(animations.length,4,'only copy enters while the app loads')
+ windowListeners.get('hero-renderer-ready')()
+ }
+ await execution
+ const clock=animations.at(-2),completionClock=animations.at(-1)
+ const cover=created.find(element=>element.tag==='path')
+ assert.equal(svg.attributes['clip-path'],'url(#ribbon-window-cover)')
+ function checkCover(){
+ const p=product.getBoundingClientRect()
+ assert(cover.attributes.d.startsWith(`M-2 -2H${viewport+2}V${ribbonHeight()+2}`),'root clipping uses viewport pixels on phone and desktop')
+ const xs=[],ys=[]
+ for(const [,command,values] of ('M'+cover.attributes.d.split('Z M')[1]).matchAll(/([MHVQ])([^MHVQZ]+)/g)){
+ const n=values.match(/-?\d*\.?\d+/g).map(Number)
+ if(command==='H')xs.push(n[0])
+ else if(command==='V')ys.push(n[0])
+ else for(let i=0;i<n.length;i+=2){xs.push(n[i]);ys.push(n[i+1])}
+ }
+ assert.equal(Math.min(...xs),p.left+1,'cutout stays inside the left border')
+ assert.equal(Math.max(...xs),p.right-1,'cutout stays inside the right border')
+ assert.equal(Math.min(...ys),p.top-100+1,'cutout stays inside the top border')
+ assert.equal(Math.max(...ys),p.bottom-100-1,'cutout stays inside the bottom border')
+ assert.equal((cover.attributes.d.match(/Q/g)||[]).length,4,'all corners follow the window')
+ }
+ checkCover()
const fade=animations.find(animation=>animation.frames[0]?.opacity===0&&!('transform' in animation.frames[0]))
const movement=animations.find(animation=>animation.frames[0]?.transform==='translateY(20px)')
assert.equal(fade.options.duration,300)
assert.equal(movement.options.duration,600,'the window keeps its original settling motion')
assert.equal(fade.options.delay,270)
- assert.equal(clock.options.duration,570+4*55+350,'keep the draw duration and band stagger')
- clock.currentTime=569;draw();assert.equal(dataset.ribbonPaint,'waiting')
- clock.currentTime=fade.options.delay+fade.options.duration;draw();assert.equal(dataset.ribbonPaint,'ready')
- clock.currentTime=700;draw()
- assert.notEqual(paths[0].attributes.d,ribbonPath(originals[0],ribbonGeometry(viewport,Math.min(viewport*.76,1200))))
- viewport=width===2560?1280:2560;onResize();draw()
+ assert.equal(clock.options.duration,270+4*55+350,'ribbons keep their duration and stagger')
+ assert.equal(completionClock.options.duration,570+4*55+350,'the app demo starts on its existing schedule')
+ clock.currentTime=fade.options.delay-1;draw();assert.equal(dataset.ribbonPaint,'waiting')
+ clock.currentTime=fade.options.delay;draw();assert.equal(dataset.ribbonPaint,'ready')
+ clock.currentTime=400;draw()
+ assert.notEqual(paths[0].attributes.d,ribbonPath(originals[0],ribbonGeometry(viewport,appWidth())))
+ viewport=width===2560?1280:2560;onResize();draw();checkCover()
if(width===2560){
reduced.matches=true;listeners.forEach(callback=>callback({matches:true}))
}else{
@@ -90,7 +121,9 @@ for(const width of [1280,1728,2560]){
}
assert.equal(dataset.heroEntry,'complete')
assert.deepEqual(events,['hero-entry-complete'])
- paths.forEach((path,i)=>assert.equal(path.attributes.d,ribbonPath(originals[i],ribbonGeometry(viewport,Math.min(viewport*.76,1200)))))
+ paths.forEach((path,i)=>assert.equal(path.attributes.d,ribbonPath(originals[i],ribbonGeometry(viewport,appWidth()))))
+ assert.equal(svg.attributes['clip-path'],undefined,'temporary clip is removed')
+ assert(created.find(element=>element.tag==='clipPath').removed,'clip definition is removed')
assert(materials.every(material=>material.removed),'temporary entry gradients are removed')
bands.forEach(band=>assert.equal(band.paths[1].attributes.fill,'url(#ribbon-surface)'))
}