Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
Configurable ken-burns: drift/zoom-out/zoom-in with amount and duration
nyblnet1cd54abf5104
diff --git a/CLAUDE.md b/CLAUDE.mdindex 86db0421..fa1c1758 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -14,7 +14,8 @@ One HTML file = the document + viewer + editor. See `README.md` for the vision.- `src/present.ts` — Reveal.js overlay; slides with `transition:'morph'` use GSAP Flip:matched `data-flip-id` elements animate geometry via Flip, style props (fill/color)tween straight from the model values. Elements carry `fx` (enter stagger — equal- `order` = simultaneous, countUp, ken-burns, `loop` dash-march/motion-path), `link`+ `order` = simultaneous, countUp, ken-burns (`fx.ken` dir drift/out/in + zoom %/secs;+ out/in are one-shot settles per slide entry), `loop` dash-march/motion-path), `link`(click → slide id) and `group`; slides can set `hover:'focus-group'` (dim othergroups). Present arrows are handled capture-phase (focus-proof). Editing UI forfx/link lives in the panel's "Presenting" section. Motion-path loops are editeddiff --git a/slides/src/editor/panels.ts b/slides/src/editor/panels.tsindex da481e3b..94493f46 100644--- a/slides/src/editor/panels.ts+++ b/slides/src/editor/panels.ts@@ -186,7 +186,7 @@ export class PropsPanel {const setFx = (patch: Partial<NonNullable<SlideElement['fx']>>) =>this.mutate(el.id, (e) => {const fx = { ...(e.fx ?? {}), ...patch }- if (!fx.enter && !fx.countUp && !fx.ambient) delete e.fx+ if (!fx.enter && !fx.countUp && !fx.ambient && !fx.loop) delete e.fxelse e.fx = fx}, true)@@ -198,7 +198,27 @@ export class PropsPanel {(v) => setFx({ countUp: v === 'on' ? true : undefined })))this.row('Ambient', this.select(['none', 'kenburns'], el.fx?.ambient ?? 'none',- (v) => setFx({ ambient: v === 'none' ? undefined : 'kenburns' })))+ (v) => setFx(v === 'none' ? { ambient: undefined, ken: undefined } : { ambient: 'kenburns' })))+ if (el.fx?.ambient === 'kenburns') {+ const ken = el.fx.ken ?? {}+ const dir = ken.dir ?? 'drift'+ const setKen = (patch: Partial<NonNullable<NonNullable<SlideElement['fx']>['ken']>>) =>+ setFx({ ken: { ...ken, ...patch } })+ this.row('Zoom', this.select(+ ['drift', 'zoom-out', 'zoom-in'],+ dir === 'out' ? 'zoom-out' : dir === 'in' ? 'zoom-in' : 'drift',+ (v) => {+ const d = v === 'zoom-out' ? 'out' : v === 'zoom-in' ? 'in' : 'drift'+ // give each style its natural pace when switching+ setFx({ ken: d === 'drift' ? undefined : { dir: d, scale: 1.06, duration: 2.5 } })+ }))+ this.row('Zoom %', this.number(+ Math.round(((ken.scale ?? (dir === 'drift' ? 1.1 : 1.06)) - 1) * 100), 1,+ (v, fin) => { if (fin) setKen({ scale: 1 + Math.min(Math.max(v, 0), 100) / 100 }) }))+ this.row('Zoom secs', this.number(+ ken.duration ?? (dir === 'drift' ? 26 : 2.5), 0.1,+ (v, fin) => { if (fin) setKen({ duration: Math.max(v, 0.1) }) }))+ }// continuous loop animationconst loop = el.fx?.loopdiff --git a/slides/src/model.ts b/slides/src/model.tsindex 9073266d..27025cdc 100644--- a/slides/src/model.ts+++ b/slides/src/model.ts@@ -26,6 +26,13 @@ export interface ElementBase {countUp?: boolean/** continuous ambient motion (slow zoom, for full-bleed photos) */ambient?: 'kenburns'+ /**+ * Ken-burns tuning. dir 'drift' (default) is the endless slow yoyo zoom;+ * 'out' and 'in' play ONCE per slide entry — 'out' starts zoomed by+ * `scale` and settles to rest (the classic title-photo effect).+ * `scale` is the far end of the zoom (e.g. 1.06), `duration` in seconds.+ */+ ken?: { dir?: 'drift' | 'out' | 'in'; scale?: number; duration?: number }/** continuous looping animation */loop?:| { type: 'dash-march'; distance?: number; duration?: number }diff --git a/slides/src/present.ts b/slides/src/present.tsindex 7523426f..75f2e40b 100644--- a/slides/src/present.ts+++ b/slides/src/present.ts@@ -323,11 +323,24 @@ function runAmbientFx(slide: Slide, section: HTMLElement) {for (const [el, node] of fxNodes(slide, section)) {const fx = el.fx!if (fx.ambient === 'kenburns') {- gsap.fromTo(- node,- { scale: 1.02 },- { scale: 1.1, duration: 26, ease: 'none', repeat: -1, yoyo: true, transformOrigin: '50% 40%' },- )+ const ken = fx.ken ?? {}+ const dir = ken.dir ?? 'drift'+ if (dir === 'drift') {+ gsap.fromTo(+ node,+ { scale: 1.02 },+ { scale: ken.scale ?? 1.1, duration: ken.duration ?? 26, ease: 'none', repeat: -1, yoyo: true, transformOrigin: '50% 40%' },+ )+ } else {+ // one-shot settle, replayed on every slide entry+ const far = ken.scale ?? 1.06+ const dur = ken.duration ?? 2.5+ gsap.fromTo(+ node,+ { scale: dir === 'out' ? far : 1 },+ { scale: dir === 'out' ? 1 : far, duration: dur, ease: 'power2.out', transformOrigin: '50% 50%', overwrite: 'auto' },+ )+ }}if (fx.loop?.type === 'dash-march') {const target = node.querySelector('path, line, rect, ellipse, polygon')