Index of every page on this site: llms.txt
All skills
johnpolacek avatar

/animaxxing

@8ddf542
Run it yourself

Build GSAP motion without restyling, as single effects or the full treatment: for "we're animaxxing", every element enters from a blank page, rests, and leaves. Text: split, scramble, glitch, typewriter, and speak-in entrances, scattering headlines, letter waves, text on a path, count-ups, odometers. Scroll: reveals, scrubbing, parallax, pinned scenes, stacking cards, zoom-through, horizontal runs, waypoints, smooth scroll, paging. Pointer: magnetic, tilt, spotlights, directional fills, press ripples, shakes, cursor followers, image trails, proximity, label rolls, underlines, weight hovers. Drag: throw tracks, endless loops, card stacks, sortable lists, swipe to dismiss. Also page covers, print effects, Flip morphs, menus, dialogs, tabs, state buttons, media and SVG effects, marquees, CustomEase, sound, confetti, particles, and hover stuck on touch. Also finds a feel: premium, calm, playful. Pair with the matching GSAP framework skill. Not for visual redesign, routing, or GSAP API questions.

Use this Skill: https://skilld.dev/gh/johnpolacek/animaxxing-skills/animaxxing

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesrecipessmooth-scroll.md

≈2.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Recipe: smooth scroll

Eased document scrolling kept in step with ScrollTrigger. Lenis smooths the window's own scroll with no markup change; ScrollSmoother moves a content wrapper and adds data-speed and data-lag. Pick one per site; both return the same controls.

Lifecycle: the persistent shell creates one scroller per document and destroys it on shell unmount; the framework skill's references/smooth-scroll.md owns stopping, scrolling, and resizing around navigation. Partial setup rolls back per effect restoration.

Dependencies: gsap, gsap/ScrollTrigger. lenisScroll needs lenis 1.3+ and lenis/dist/lenis.css (which holds the page while stopped), imported once from the shell's global styles. smootherScroll needs gsap/ScrollSmoother. Lenis option names change between minors; check the installed version and types.

Lenis scrolls the window, so the document itself must scroll: no fixed-height app shell with its own overflow. Stopping clips the root's overflow; scrollbar-gutter: stable on html prevents a classic scrollbar's reflow. Keyboard, scrollbar, find-in-page, focus scrolling, and touch stay native (touch unless syncTouch is set). Exempt inner scroll areas with data-lenis-prevent. Lenis's anchors: true eases hash links on plain pages; leave it off where a router handles them.

scroll-controls.ts

import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";

gsap.registerPlugin(ScrollTrigger);

/* Swap for the project's helper if it has one. */
export function prefersReducedMotion(): boolean {
  if (typeof window === "undefined") return true;
  const choice = document.documentElement.dataset.motion;
  if (choice === "reduced") return true;
  if (choice === "full") return false;
  return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}

export type ScrollTarget = number | string | HTMLElement;
export type ScrollToOptions = {
  /** Jump instead of easing, as after a route swap or a history restore. */
  immediate?: boolean;
  /** Pixels added to the target position; negative clears a fixed header. */
  offset?: number;
};

export type SmoothScroll = {
  /** Holds the page still. A stopped ScrollSmoother undoes native scrolls; sync a router's scroll with `scrollTo` in the same task. */
  stop(): void;
  start(): void;
  /** Scrolls to a position, a selector, or an element, even while stopped. */
  scrollTo(target: ScrollTarget, options?: ScrollToOptions): void;
  /** Re-measures after content changes size, then refreshes ScrollTrigger. */
  resize(): void;
  /** Idempotent. Restores native scrolling and removes everything the engine added. */
  destroy(): void;
};

/** A target's document position in px, or undefined when a selector matches nothing. */
export function resolveTarget(target: ScrollTarget): number | undefined {
  if (typeof target === "number") return target;
  const element = typeof target === "string" ? document.querySelector(target) : target;
  return element ? element.getBoundingClientRect().top + window.scrollY : undefined;
}

/**
 * Native scrolling behind the same controls: the reduced-motion path of both
 * engines. Stop and start do nothing, since reduced-motion outros are instant.
 */
export function nativeScroll(): SmoothScroll {
  return {
    stop() {},
    start() {},
    scrollTo(target, { immediate = false, offset = 0 } = {}) {
      const top = resolveTarget(target);
      if (top === undefined) return;
      window.scrollTo({ top: top + offset, behavior: immediate || prefersReducedMotion() ? "instant" : "smooth" });
    },
    resize() {
      ScrollTrigger.refresh();
    },
    destroy() {},
  };
}

lenis-scroll.ts

import gsap from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import Lenis, { type LenisOptions } from "lenis";
import { nativeScroll, prefersReducedMotion, type SmoothScroll } from "./scroll-controls";

/**
 * Lenis on the window, stepped by GSAP's ticker so ScrollTrigger reads the
 * same frame. `options` pass through to Lenis; `lerp` or `duration` set the feel.
 * GSAP's lag smoothing is left as the app set it.
 */
export function lenisScroll(options: LenisOptions = {}): SmoothScroll {
  if (prefersReducedMotion()) return nativeScroll();
  // The helper above already decided, including the app's own motion setting; Lenis would read only the OS.
  const lenis = new Lenis({ ...options, autoRaf: false, respectReducedMotion: false });
  const tick = (time: number) => lenis.raf(time * 1000);
  let offScroll: (() => void) | undefined;
  let destroyed = false;
  const destroy = () => {
    if (destroyed) return;
    destroyed = true;
    gsap.ticker.remove(tick);
    offScroll?.();
    lenis.destroy();
  };
  try {
    offScroll = lenis.on("scroll", ScrollTrigger.update);
    gsap.ticker.add(tick);
  } catch (error) {
    destroy();
    throw error;
  }
  return {
    stop: () => lenis.stop(),
    start: () => lenis.start(),
    scrollTo(target, { immediate = false, offset = 0 } = {}) {
      // Lenis clamps to the height it last measured; a jump into a taller page after a swap needs a fresh measure.
      if (immediate) lenis.resize();
      lenis.scrollTo(target, { immediate, offset, force: true });
    },
    resize() {
      lenis.resize();
      ScrollTrigger.refresh();
    },
    destroy,
  };
}

smoother-scroll.ts

ScrollSmoother needs a fixed wrapper around a content element holding the page. Fixed and sticky UI, such as a header or curtain, sits outside the wrapper, since the content moves by transform.

<header>…</header>
<div id="smooth-wrapper"><div id="smooth-content">…page…</div></div>
import gsap from "gsap";
import { ScrollSmoother } from "gsap/ScrollSmoother";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { nativeScroll, prefersReducedMotion, type SmoothScroll } from "./scroll-controls";

gsap.registerPlugin(ScrollTrigger, ScrollSmoother);

export type SmootherOptions = {
  /** Seconds the content takes to catch up with the scrollbar. */
  smooth?: number;
  /** Reads `data-speed` and `data-lag` inside the content. */
  effects?: boolean;
  /** Smoothing on touch, in seconds; `false` keeps touch native. */
  smoothTouch?: number | false;
};

export function smootherScroll(
  wrapper: HTMLElement,
  content: HTMLElement,
  { smooth = 1, effects = true, smoothTouch = false }: SmootherOptions = {},
): SmoothScroll {
  if (prefersReducedMotion()) return nativeScroll();
  // create() writes scroll-behavior on <html> and <body> and kill() leaves it; put it back on destroy.
  const roots = [document.documentElement, document.body];
  const behaviors = roots.map((root) => [root.style.getPropertyValue("scroll-behavior"), root.style.getPropertyPriority("scroll-behavior")] as const);
  const restoreBehavior = () =>
    roots.forEach((root, i) => {
      const [value, priority] = behaviors[i] ?? ["", ""];
      if (value) root.style.setProperty("scroll-behavior", value, priority);
      else root.style.removeProperty("scroll-behavior");
    });
  let smoother: ScrollSmoother;
  try {
    smoother = ScrollSmoother.create({ wrapper, content, smooth, effects, smoothTouch });
  } catch (error) {
    restoreBehavior();
    throw error;
  }
  let destroyed = false;
  return {
    stop: () => smoother.paused(true),
    start: () => smoother.paused(false),
    scrollTo(target, { immediate = false, offset = 0 } = {}) {
      const element = typeof target === "string" ? document.querySelector(target) : target;
      // A stale hash matches nothing; do nothing, as the other engines do.
      if (element === null) return;
      const top = typeof element === "number" ? element : smoother.offset(element, "top top");
      smoother.scrollTo(top + offset, !immediate);
    },
    resize: () => ScrollTrigger.refresh(),
    destroy() {
      if (destroyed) return;
      destroyed = true;
      // kill() reverts the wrapper's and content's inline styles and removes its listeners.
      smoother.kill();
      restoreBehavior();
    },
  };
}

Scrolling an element

lenisScroll also drives one element's scroll instead of the window's: pass the element as both wrapper and content, and the element's own triggers as scroller. Use it when scroll effects pin inside a nested scroller, where native scrolling makes the pin hop a frame behind. The element keeps native keyboard and scrollbar scrolling. Destroy it with the element's owner, not the shell.

// Example: a panel that scrolls on its own, with a pinned scene inside it.
const smooth = lenisScroll({ wrapper: panel, content: panel });
const scene = pinnedScene(panel.querySelector("section")!, build, { scroller: panel });
// On unmount: scene(); smooth.destroy();

Wiring

// In the persistent shell, once per document, before any page creates a ScrollTrigger:
const scroller = lenisScroll({ lerp: 0.1 });
// Outro or covered swap: scroller.stop();
// After a swap or history restore, once the router or browser has scrolled:
//               scroller.scrollTo(window.scrollY, { immediate: true });
// Intro built:  scroller.resize(); scroller.start();
// Shell unmount: scroller.destroy();

Controller contract

Builder Create Returns Reduced motion
lenisScroll Once per document, from the persistent shell controls Native controls, same API; nothing created
smootherScroll Same, before any ScrollTrigger exists controls Native controls, same API; wrapper stays plain
  • One scroller per document. Page-level effects never create or destroy it.
  • A stopped ScrollSmoother undoes native scrolls on its next scroll event. When a router scrolls while it is stopped, call scrollTo(window.scrollY, { immediate: true }) in the same task, such as a microtask after the commit, never a frame later. Lenis adopts native jumps while stopped.
  • ScrollTrigger effects need no custom scroller: Lenis moves the window, and ScrollSmoother registers itself as the default.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill is a comprehensive library of TypeScript and GSAP-based animation recipes. It provides reusable code for text, scroll, pointer, layout, and particle effects. Analysis of the code and instructions reveals no malicious behavior, data exfiltration, or prompt injection attempts. All network operations and DOM manipulations are consistent with the skill's stated purpose of providing UI animations.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 8ddf542. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "short-description": "Reusable GSAP text, scroll, pointer, layout, SVG, and particle motion for any brand"
}

README badge

README badge for johnpolacek/animaxxing-skills/animaxxing