From 2d2e1f52afaf1eb142e391c00450bc379c745f2f Mon Sep 17 00:00:00 2001 From: memdmp Date: Thu, 23 Jan 2025 02:11:44 +0100 Subject: feat: cutely wrap console logging functions, etc --- src/routes/anim-gen.ts | 84 ++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 44 deletions(-) (limited to 'src/routes/anim-gen.ts') diff --git a/src/routes/anim-gen.ts b/src/routes/anim-gen.ts index 382237e..550efb7 100644 --- a/src/routes/anim-gen.ts +++ b/src/routes/anim-gen.ts @@ -113,17 +113,17 @@ const biosStepHandlers: Step[] = [ biosSteps, ).fill( (quantity: number, lastQuantity: number, index: number) => - (next: () => void) => { - const s = anim.selector( - `#bios .bar`, - ); - s.style(`${index === 0 ? hiddenStyles : visibleStyles} + (next: () => void) => { + const s = anim.selector( + `#bios .bar`, + ); + s.style(`${index === 0 ? hiddenStyles : visibleStyles} width: ${lastQuantity * 100}vw;`); - anim._internal_timeline.now += 1; - s.style(`${visibleStyles} + anim._internal_timeline.now += 1; + s.style(`${visibleStyles} width: ${quantity * 100}vw;`); - anim.in(quantity === 1 ? 50 : biosStepInterval, next); - }, + anim.in(quantity === 1 ? 50 : biosStepInterval, next); + }, ).map((v, i, a) => v((i + 1) / a.length, i / a.length, i)), // Show bdsdxe (next) => { @@ -378,8 +378,7 @@ const ttyStepHandlers: Step[] = [ switch (step.kind) { case 'text': { const s = anim.selector( - `${isBeforeFirstClear ? '#openrc' : '#tty-' + (ttyIdx - 1)} ${ - step.classes.map((v) => `.${v}`).join('') + `${isBeforeFirstClear ? '#openrc' : '#tty-' + (ttyIdx - 1)} ${step.classes.map((v) => `.${v}`).join('') }`, ); s.style(altHiddenStyles); @@ -391,8 +390,7 @@ const ttyStepHandlers: Step[] = [ } case 'removeNode': { const s = anim.selector( - `${isBeforeFirstClear ? '#openrc' : '#tty-' + (ttyIdx - 1)} ${ - step.removedItemClassList.map((v) => `.${v}`).join('') + `${isBeforeFirstClear ? '#openrc' : '#tty-' + (ttyIdx - 1)} ${step.removedItemClassList.map((v) => `.${v}`).join('') }`, ); s.style(altVisibleStyles); @@ -460,9 +458,8 @@ const output = `/** * You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ ${anim.exportToCSS()} -${ - stages.filter((_, i, a) => i !== a.length - 1).map((v) => - `${v.selector} { +${stages.filter((_, i, a) => i !== a.length - 1).map((v) => + `${v.selector} { ${hiddenStageStyles} } .ttytext-removed-after-done { @@ -473,35 +470,34 @@ ${hiddenStageStyles} margin-left: -100vw; margin-right: 100vw; } -${ - (ttyLines.flatMap((v) => - v.kind === 'text' - ? [ - ...v.value.map((v) => ({ - kind: 'text' as const, - ...v, - })), - ] - : [] - ).flatMap((v) => [ - ...( - v.kind === 'text' - ? [ - v.colour - ? `.ttytext-block.text-\\[\\${v.colour}\\]{color:${v.colour};}` - : '', - v.bg - ? `.ttytext-block.bg-\\[\\${v.bg}\\]{background:${v.bg};}` - : '', - ] - : [] - ), - ]).filter((v, i, a) => v.length !== 0 && a.indexOf(v) === i)).join('\n') - } +${(ttyLines.flatMap((v) => + v.kind === 'text' + ? [ + ...v.value.map((v) => ({ + kind: 'text' as const, + ...v, + })), + ] + : [] + ).flatMap((v) => [ + ...( + v.kind === 'text' + ? [ + v.colour + ? `.ttytext-block.text-\\[\\${v.colour}\\]{color:${v.colour};}` + : '', + v.bg + ? `.ttytext-block.bg-\\[\\${v.bg}\\]{background:${v.bg};}` + : '', + ] + : [] + ), + ]).filter((v, i, a) => v.length !== 0 && a.indexOf(v) === i)).join('\n') + } ` - ).join('') -} -${[...anim.exportToObject().values()].map(v=>`#app.skip-animation ${v.selector} { +).join('') + } +${[...anim.exportToObject().values()].map(v => `#app.skip-animation ${v.selector} { animation-duration: 0.01ms; }`).join('\n')} `; -- cgit v1.2.3