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.

referencesrecipespress-feedback.md

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

Recipe: press feedback

A control answers the moment it is pressed. It squashes a little under the press and springs back on release, and an ink ripple spreads from the exact point pressed. Mouse, touch, pen, and the keyboard all get it: Enter and Space press from the center. Use either move alone or both together.

Lifecycle: the framework controller builds it once the control is mounted and calls the idempotent teardown on unmount. Partial setup rolls back per effect restoration.

Dependencies: gsap.

/* The ripple's ink: the control's text color by default. */
[data-ripple] { background: currentColor; }
import gsap from "gsap";

/* Swap for the project's helper if it has one. */
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 Teardown = () => void;
type Register = (fn: () => void) => void;

/**
 * Runs setup in its own GSAP context and returns a once-only teardown that also rolls back a throw.
 * `dispose` stops writers and listeners before the context reverts; `after` restores after it.
 */
function own(setup: (dispose: Register, after: Register) => void): Teardown {
  const ctx = gsap.context(() => {});
  const disposers: Array<() => void> = [];
  const restores: Array<() => void> = [];
  let done = false;
  const teardown = () => {
    if (done) return;
    done = true;
    let failure: unknown;
    const attempt = (fn: () => void) => {
      try {
        fn();
      } catch (error) {
        failure ??= error;
      }
    };
    disposers.splice(0).reverse().forEach(attempt);
    attempt(() => ctx.revert());
    restores.splice(0).reverse().forEach(attempt);
    if (failure) throw failure;
  };
  let failure: { error: unknown } | undefined;
  // Catch inside add: GSAP restores its current context only when add returns.
  ctx.add(() => {
    try {
      setup((fn) => disposers.push(fn), (fn) => restores.push(fn));
    } catch (error) {
      failure = { error };
    }
  });
  if (failure) {
    teardown();
    throw failure.error;
  }
  return teardown;
}

/** Records inline properties and returns a restore; `clearProps` also resets GSAP's cached transform. */
function snapshotStyles(elements: HTMLElement[], props: string[]): () => void {
  const saved = elements.map((element) => props.map((prop) =>
    [element.style.getPropertyValue(prop), element.style.getPropertyPriority(prop)] as const));
  return () =>
    elements.forEach((element, i) => {
      gsap.set(element, { clearProps: props.join(",") });
      props.forEach((prop, j) => {
        const [value, priority] = saved[i]?.[j] ?? ["", ""];
        if (value) element.style.setProperty(prop, value, priority);
        else element.style.removeProperty(prop);
      });
    });
}

export type PressOptions = {
  /** Scale while pressed; 1 turns the squash off. */
  squash?: number;
  /** Spread an ink ripple from the press point. */
  ripple?: boolean;
  /** Ripple ink opacity at its start. */
  ink?: number;
};

/** The press and the release, with the spring on the way back. */
const PRESS = { duration: 0.12, ease: "power2.out" } as const;
const RELEASE = { duration: 0.5, ease: "elastic.out(1, 0.45)" } as const;
const RIPPLE = { duration: 0.6, ease: "power2.out" } as const;

export function pressFeedback(control: HTMLElement, { squash = 0.94, ripple = true, ink = 0.3 }: PressOptions = {}): Teardown {
  if (prefersReducedMotion()) return () => {};
  return own((dispose, after) => {
    after(snapshotStyles([control], ["transform", "translate", "scale", "position", "overflow", "-webkit-tap-highlight-color"]));
    // The squash and ripple are the touch response; the browser's own tap highlight would box the control over them.
    control.style.setProperty("-webkit-tap-highlight-color", "transparent");
    const style = getComputedStyle(control);
    // The ripple needs a positioned, clipping box; set only what the control lacks.
    if (ripple && style.position === "static") control.style.position = "relative";
    if (ripple && style.overflow === "visible") control.style.overflow = "clip";
    const ripples = new Set<HTMLElement>();
    dispose(() => {
      ripples.forEach((element) => element.remove());
      gsap.killTweensOf(control);
    });
    let pressed = false;

    const spread = (x: number, y: number) => {
      const box = control.getBoundingClientRect();
      // Large enough to reach the farthest corner from the press point.
      const reach = Math.hypot(Math.max(x, box.width - x), Math.max(y, box.height - y));
      const drop = document.createElement("span");
      drop.dataset.ripple = "";
      drop.setAttribute("aria-hidden", "true");
      Object.assign(drop.style, {
        position: "absolute",
        left: `${x - reach}px`,
        top: `${y - reach}px`,
        width: `${reach * 2}px`,
        height: `${reach * 2}px`,
        borderRadius: "50%",
        pointerEvents: "none",
      });
      control.append(drop);
      ripples.add(drop);
      gsap.fromTo(drop, { scale: 0, opacity: ink }, { scale: 1, opacity: 0, ...RIPPLE, onComplete: () => (drop.remove(), ripples.delete(drop)) });
    };
    const press = (x: number, y: number) => {
      if (pressed) return;
      pressed = true;
      if (squash !== 1) gsap.to(control, { scale: squash, ...PRESS, overwrite: "auto" });
      if (ripple) spread(x, y);
    };
    const release = () => {
      if (!pressed) return;
      pressed = false;
      if (squash !== 1) gsap.to(control, { scale: 1, ...RELEASE, overwrite: "auto" });
    };

    const on = <K extends keyof HTMLElementEventMap>(type: K, handler: (event: HTMLElementEventMap[K]) => void) => {
      control.addEventListener(type, handler);
      dispose(() => control.removeEventListener(type, handler));
    };
    on("pointerdown", (event) => {
      if (event.button !== 0) return;
      const box = control.getBoundingClientRect();
      press(event.clientX - box.left, event.clientY - box.top);
    });
    // A scroll that starts on touch cancels the pointer; the control springs back.
    on("pointerup", release);
    on("pointercancel", release);
    on("pointerleave", release);
    on("keydown", (event) => {
      if (event.repeat || (event.key !== "Enter" && event.key !== " ")) return;
      const box = control.getBoundingClientRect();
      press(box.width / 2, box.height / 2);
    });
    on("keyup", release);
    on("blur", release);
  });
}

The squash scales the whole control, so keep it near 1 on large surfaces and leave text-heavy cards at squash: 1. The ripple uses the control's text color at ink opacity; on a control whose text color is near its background, set a [data-ripple] background from an existing brand token.

Controller contract

Builder Create Returns Reduced motion
pressFeedback Settled, once the control is mounted teardown No-op; the control's own :active style stays
  • One pointer response per control: do not combine with magnetic, tilt, or a particle hot state, which also write the control's transform.
  • The ripple spans live only while they spread, and teardown removes any in flight.

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