diff --git a/src/app.d.ts b/src/app.d.ts index 3ba48af..4f7508c 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -7,6 +7,11 @@ declare global { // interface PageData {} // interface Platform {} } + + // sveltekit-autoimport types + + declare const fade: typeof import("$lib/fade").default + declare const Footer: typeof import("$lib/components/Footer.svelte").default declare const Navbar: typeof import("$lib/components/Navbar.svelte").default declare const Stars: typeof import("$lib/components/Stars.svelte").default diff --git a/src/lib/fade.ts b/src/lib/fade.ts new file mode 100644 index 0000000..990f6a2 --- /dev/null +++ b/src/lib/fade.ts @@ -0,0 +1,10 @@ +// Builds on the Svelte fade function to allow for easier delays for +// staggered animations, taken directly from Mercury + +import { fade } from "svelte/transition" + +export default (node: HTMLElement, props: any = { duration: 300 }) => { + if (props.num && props.total) + props.delay = (props.num * 150) / Math.min(props.total, props?.max || 6) + return fade(node, props) +} diff --git a/src/routes/+page.svx b/src/routes/+page.svx index fa11625..ab8bde7 100644 --- a/src/routes/+page.svx +++ b/src/routes/+page.svx @@ -7,7 +7,7 @@ # Revival Archive ### a [Mercury](https://banland.xyz) project -