Skip to content

Diogenesoftoronto/keating / video/keating-surface-tour/.agents/skills/hyperframes-animation

hyperframes-animation

Verified

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

FileKindSize
SKILL.mdskill md7.6 KB
adapters/animate-text.mdmarkdown4.0 KB
adapters/animejs.mdmarkdown6.1 KB
adapters/css-animations.mdmarkdown5.3 KB
adapters/gsap-easing-and-stagger.mdmarkdown13.0 KB
adapters/gsap-timeline-and-labels.mdmarkdown3.6 KB
adapters/gsap-transforms-and-perf.mdmarkdown8.4 KB
adapters/gsap.mdmarkdown6.9 KB
adapters/html-in-canvas-patterns.mdmarkdown16.8 KB
adapters/lottie.mdmarkdown4.0 KB
adapters/three.mdmarkdown5.1 KB
adapters/typegpu.mdmarkdown7.9 KB
adapters/waapi.mdmarkdown4.1 KB
blueprints-index.mdmarkdown25.9 KB
blueprints/agent-progress-theater.mdmarkdown15.7 KB
blueprints/camera-journey.mdmarkdown13.3 KB
blueprints/comparison-split.mdmarkdown3.2 KB
blueprints/constellation-hub.mdmarkdown7.0 KB
blueprints/cta-morph-press.mdmarkdown6.3 KB
blueprints/cursor-ui-demo.mdmarkdown19.8 KB
blueprints/dataviz-countup.mdmarkdown14.3 KB
blueprints/device-surface-showcase.mdmarkdown16.7 KB
blueprints/fixed-anchor-cycle.mdmarkdown8.9 KB
blueprints/grid-card-assemble.mdmarkdown15.2 KB
blueprints/kinetic-type-beats.mdmarkdown28.5 KB
blueprints/logo-assemble-lockup.mdmarkdown26.0 KB
blueprints/overwhelm-surround.mdmarkdown6.0 KB
blueprints/panel-edit-live-sync.mdmarkdown13.1 KB
blueprints/prompt-type-submit-generate.mdmarkdown18.2 KB
blueprints/spatial-pan-stations.mdmarkdown4.8 KB
blueprints/ticker-takeover.mdmarkdown3.0 KB
blueprints/titlecard-reveal.mdmarkdown7.3 KB
blueprints/transcript-scroll-artifact-reveal.mdmarkdown11.4 KB
blueprints/typewriter-reveal.mdmarkdown6.1 KB
blueprints/video-text-pivot.mdmarkdown3.2 KB
blueprints/zoom-out-workspace-reveal.mdmarkdown14.4 KB
examples/brand-reveal-assemble-zoom.htmlother12.0 KB
examples/comparison-split-cards.htmlother21.2 KB
examples/concept-demo-decode-pan.htmlother18.0 KB
examples/cta-morph-press.htmlother14.8 KB
examples/cta-orbit-collapse.htmlother49.5 KB
examples/demo-page-scroll-spotlight.htmlother24.4 KB
examples/hook-counter-burst.htmlother22.5 KB
examples/messaging-multi-phrase.htmlother11.9 KB
examples/metric-video-text-pivot.htmlother25.0 KB
examples/problem-mockup-overwhelm.htmlother43.4 KB
examples/proof-logo-chain.htmlother28.2 KB
examples/takeover-ticker-displace.htmlother10.7 KB
examples/workflow-approve-press.htmlother20.2 KB
rules-index.mdmarkdown20.7 KB
rules/3d-camera-flight.mdmarkdown17.7 KB
rules/3d-page-scroll.mdmarkdown7.2 KB
rules/3d-text-depth-layers.mdmarkdown6.6 KB
rules/ai-tracking-box.mdmarkdown6.4 KB
rules/ambient-glow-bloom.mdmarkdown9.6 KB
rules/anchored-layout-expand.mdmarkdown10.1 KB
rules/asr-keyword-glow.mdmarkdown6.6 KB
rules/avatar-cloud-network.mdmarkdown6.4 KB
rules/camera-cursor-tracking.mdmarkdown7.7 KB
rules/card-morph-anchor.mdmarkdown7.2 KB
rules/center-outward-expansion.mdmarkdown4.2 KB
rules/chart-scrub-readout.mdmarkdown10.1 KB
rules/chromatic-glitch.mdmarkdown10.1 KB
rules/context-sensitive-cursor.mdmarkdown6.8 KB
rules/control-target-sync.mdmarkdown10.0 KB
rules/coordinate-target-zoom.mdmarkdown7.4 KB
rules/counting-dynamic-scale.mdmarkdown5.8 KB
rules/css-marker-patterns.mdmarkdown5.6 KB
rules/cursor-click-ripple.mdmarkdown6.3 KB
rules/cursor-drag.mdmarkdown10.0 KB
rules/depth-of-field-blur.mdmarkdown8.7 KB
rules/depth-scatter-assemble.mdmarkdown6.9 KB
rules/discrete-text-sequence.mdmarkdown6.3 KB
rules/dynamic-content-sequencing.mdmarkdown8.4 KB
rules/gradient-text-sweep.mdmarkdown8.5 KB
rules/gsap-effects.mdmarkdown6.8 KB
rules/hacker-flip-3d.mdmarkdown5.5 KB
rules/kinetic-beat-slam.mdmarkdown6.3 KB
rules/motion-blur-streak.mdmarkdown10.4 KB
rules/multi-cursor-choreography.mdmarkdown10.3 KB
rules/multi-phase-camera.mdmarkdown7.6 KB
rules/nudge-curve.mdmarkdown2.6 KB
rules/orbit-3d-entry.mdmarkdown6.5 KB
rules/particle-burst.mdmarkdown9.7 KB
rules/physics-press-reaction.mdmarkdown6.5 KB
rules/press-release-spring.mdmarkdown6.9 KB
rules/reactive-displacement.mdmarkdown6.4 KB
rules/scale-swap-transition.mdmarkdown5.4 KB
rules/sine-wave-loop.mdmarkdown6.0 KB
rules/split-tilt-cards.mdmarkdown5.5 KB
rules/spring-pop-entrance.mdmarkdown6.4 KB
rules/stat-bars-and-fills.mdmarkdown5.4 KB
rules/svg-icon-enrichment.mdmarkdown7.4 KB
rules/svg-path-draw.mdmarkdown5.2 KB
rules/theme-crossfade-morph.mdmarkdown9.2 KB
rules/vertical-spring-ticker.mdmarkdown5.4 KB
rules/viewport-change.mdmarkdown8.8 KB
rules/waterfall-entry.mdmarkdown4.5 KB
scripts/animation-map-sampling.mjsscript1.4 KB
scripts/animation-map-sampling.test.mjsscript1.6 KB
scripts/animation-map.mjsscript19.8 KB
scripts/animation-map.test.mjsscript12.1 KB
scripts/package-loader.mjsscript13.2 KB
scripts/package-loader.test.mjsscript2.5 KB
techniques.mdmarkdown15.4 KB
transitions/TRANSITION-REGISTRY.mdmarkdown7.9 KB
transitions/catalog.mdmarkdown6.5 KB
transitions/css-3d.mdmarkdown421 B
transitions/css-blur.mdmarkdown1.7 KB
transitions/css-cover.mdmarkdown1.4 KB
transitions/css-destruction.mdmarkdown4.4 KB
transitions/css-dissolve.mdmarkdown2.4 KB
transitions/css-distortion.mdmarkdown1.8 KB
transitions/css-grid.mdmarkdown370 B
transitions/css-light.mdmarkdown2.3 KB
transitions/css-mechanical.mdmarkdown1.6 KB
transitions/css-other.mdmarkdown838 B
transitions/css-push.mdmarkdown1.2 KB
transitions/css-radial.mdmarkdown1.0 KB
transitions/css-scale.mdmarkdown715 B
transitions/overview.mdmarkdown13.5 KB

scripts/package-loader.mjs

View on GitHub
// package-loader — bootstrap optional helper packages only when missing, with
// defense-in-depth so a malicious or typo'd dependency can't run on install:
//   • specs are version-pinned (assertPinnedPackageSpecs) — no floating "latest"
//   • install runs `npm install --ignore-scripts` — package lifecycle scripts
//     never execute
//   • `--no-save` into a throwaway tmp dir — the host project is left untouched
//   • requires an interactive y/N (or an explicit $HYPERFRAMES_SKILL_BOOTSTRAP_DEPS=1)
//   • npm is spawned with an argv array (no shell) — never a built command string
// The `installLine` strings below are DISPLAY ONLY (shown in the prompt / error
// text); they are never handed to a shell or executed.
import { spawnSync } from "node:child_process";
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { createRequire } from "node:module";
import { tmpdir } from "node:os";
import { basename, delimiter, dirname, join, parse, resolve } from "node:path";
import { createInterface } from "node:readline/promises";
import { fileURLToPath, pathToFileURL } from "node:url";

const HERE = dirname(fileURLToPath(import.meta.url));
const VERSION_OVERRIDE_ENV = "HYPERFRAMES_SKILL_PKG_VERSION";
const BOOTSTRAP_ENV = "HYPERFRAMES_SKILL_DEPS_BOOTSTRAPPED";
const BOOTSTRAP_CONFIRM_ENV = "HYPERFRAMES_SKILL_BOOTSTRAP_DEPS";
const NODE_MODULES_ENV = "HYPERFRAMES_SKILL_NODE_MODULES";

export async function importPackagesOrBootstrap(packageNames, options = {}) {
  const entries = new Map();
  const missing = [];

  for (const packageName of packageNames) {
    const entry = resolvePackageEntry(packageName);
    if (entry) entries.set(packageName, entry);
    else missing.push(packageName);
  }

  if (missing.length > 0 && !process.env[BOOTSTRAP_ENV]) {
    const npmPackages = options.npmPackages ?? missing;
    assertPinnedPackageSpecs(npmPackages);
    await confirmBootstrap(npmPackages);
    bootstrapWithNpmInstall(npmPackages);
  }

  if (missing.length > 0) {
    throw new Error(
      [
        `Could not resolve required package(s): ${missing.join(", ")}`,
        "Install them in this project, for example:",
        `  npm install --save-dev ${packageNames.map(shellQuote).join(" ")}`,
      ].join("\n"),
    );
  }

  const modules = {};
  for (const [packageName, entry] of entries) {
    modules[packageName] = await import(pathToFileURL(entry).href);
  }
  return modules;
}

export async function bundleCompositionForCapture(compiler, projectDir) {
  const compiledDir = mkdtempSync(join(tmpdir(), "hyperframes-skill-bundle-"));
  try {
    const html = await compiler.bundleToSingleHtml(projectDir);
    writeFileSync(join(compiledDir, "index.html"), html);
    return {
      compiledDir,
      cleanup() {
        rmSync(compiledDir, { recursive: true, force: true });
      },
    };
  } catch (error) {
    rmSync(compiledDir, { recursive: true, force: true });
    throw error;
  }
}

// ── Transient-init retry ─────────────────────────────────────────────────────
// Frozen snapshot of the engine's TRANSIENT_BROWSER_ERROR_PATTERNS (see
// packages/engine frameCapture.ts), used only when the imported
// @hyperframes/producer predates the isTransientBrowserError re-export. The
// last pattern is the load-bearing one for modular projects: sub-composition
// timelines register asynchronously, so a first init attempt can time out as
// "zero duration / Runtime ready: false" on a valid project.
const FALLBACK_TRANSIENT_PATTERNS = [
  /Navigating frame was detached/i,
  /Target closed/i,
  /Session closed/i,
  /browser has disconnected/i,
  /Page crashed/i,
  /Execution context was destroyed/i,
  /Cannot find context with specified id/i,
  /Failed to launch the browser process/i,
  /Navigation timeout of \d+ ms exceeded/i,
  /ECONNREFUSED/i,
  /net::ERR_NETWORK_CHANGED/i,
  /Composition has zero duration[\s\S]*Runtime ready: false/,
];

/**
 * Create + initialize a capture session with the canonical transient-init
 * retry/cleanup the render pipeline uses (see probeStage in
 * @hyperframes/producer): on a transient failure, close the crashed session
 * and retry ONCE with a fresh browser. Without this, a standalone helper
 * false-fails valid modular projects whose sub-composition timelines land a
 * beat after the first readiness deadline ("zero duration" with
 * "Runtime ready: false").
 *
 * `producer` is the imported @hyperframes/producer namespace;
 * `createSession` is a factory returning a fresh (uninitialized) session.
 * Non-transient init failures (e.g. the "Runtime ready: true" zero-duration
 * fast-fail — a genuine authoring bug) still throw on the first attempt.
 */
export async function initializeSessionWithRetry(producer, createSession, options = {}) {
  const maxAttempts = options.maxAttempts ?? 2;
  const log = options.log ?? ((message) => console.error(message));
  const isTransient =
    typeof producer.isTransientBrowserError === "function"
      ? producer.isTransientBrowserError
      : (err) => {
          const message = err instanceof Error ? err.message : String(err);
          return FALLBACK_TRANSIENT_PATTERNS.some((pattern) => pattern.test(message));
        };

  for (let attempt = 1; ; attempt++) {
    const session = await createSession();
    try {
      await producer.initializeSession(session);
      return session;
    } catch (error) {
      await producer.closeCaptureSession(session).catch(() => {});
      if (attempt >= maxAttempts || !isTransient(error)) throw error;
      log(
        `transient browser-init failure (attempt ${attempt}/${maxAttempts}): ${
          error instanceof Error ? error.message : String(error)
        }`,
      );
      log("retrying with a fresh browser session...");
    }
  }
}

export function hyperframesPackageSpec(packageName) {
  const override = process.env[VERSION_OVERRIDE_ENV]?.trim();
  if (override) return `${packageName}@${override}`;

  const version = readBundledHyperframesVersion();
  if (version) return `${packageName}@${version}`;

  // Global skill installs have no hyperframes package.json
  // in their ancestor chain, so the bundled version is unknowable. Fall back to
  // @latest instead of throwing: already-installed packages still import, and a
  // bootstrap install can still proceed (@latest satisfies the pinned-spec guard).
  process.stderr.write(
    [
      `hyperframes: could not determine the bundled version for ${packageName}; using @latest.`,
      `Set ${VERSION_OVERRIDE_ENV}=<version> to pin it.`,
      "",
    ].join("\n"),
  );
  return `${packageName}@latest`;
}

function resolvePackageEntry(packageName) {
  const bases = [process.cwd(), HERE, ...envNodeModulesDirs(), ...nodeModulesDirsFromPath()];
  const { rootName, subpath } = splitPackageSpecifier(packageName);

  const seen = new Set();
  for (const base of bases) {
    const normalized = resolve(base);
    if (seen.has(normalized)) continue;
    seen.add(normalized);

    try {
      return createRequire(join(normalized, "__hyperframes_skill_loader__.cjs")).resolve(
        packageName,
      );
    } catch {
      const packageDir = findPackageDir(normalized, rootName);
      const packageEntry = packageDir ? readPackageEntry(packageDir, subpath) : null;
      if (packageEntry) return packageEntry;
    }
  }

  return null;
}

function splitPackageSpecifier(packageName) {
  const segments = packageName.split("/");
  const rootLength = packageName.startsWith("@") ? 2 : 1;
  return {
    rootName: segments.slice(0, rootLength).join("/"),
    subpath: segments.slice(rootLength).join("/"),
  };
}

function readBundledHyperframesVersion() {
  for (const ancestor of ancestors(HERE)) {
    const directVersion = readPackageVersion(join(ancestor, "package.json"));
    if (directVersion) return directVersion;

    const monorepoCliVersion = readPackageVersion(
      join(ancestor, "packages", "cli", "package.json"),
    );
    if (monorepoCliVersion) return monorepoCliVersion;
  }
  return null;
}

function readPackageVersion(packageJsonPath) {
  try {
    const manifest = JSON.parse(readFileSync(packageJsonPath, "utf8"));
    if (manifest.name === "hyperframes" || manifest.name === "@hyperframes/cli") {
      return typeof manifest.version === "string" ? manifest.version : null;
    }
  } catch {
    // Keep searching ancestor package manifests.
  }
  return null;
}

function envNodeModulesDirs() {
  return (process.env[NODE_MODULES_ENV] ?? "").split(delimiter).filter(Boolean);
}

function nodeModulesDirsFromPath() {
  const dirs = [];
  for (const entry of (process.env.PATH ?? "").split(delimiter)) {
    if (!entry.endsWith(`${join("node_modules", ".bin")}`)) continue;
    dirs.push(dirname(entry));
  }
  return dirs;
}

function findPackageDir(base, packageName) {
  const packageSegments = packageName.split("/");
  const roots =
    basename(base) === "node_modules"
      ? [base]
      : ancestors(base).map((ancestor) => join(ancestor, "node_modules"));

  for (const root of roots) {
    const packageDir = join(root, ...packageSegments);
    if (existsSync(join(packageDir, "package.json"))) return packageDir;
  }
  return null;
}

function readPackageEntry(packageDir, subpath = "") {
  try {
    const manifest = JSON.parse(readFileSync(join(packageDir, "package.json"), "utf8"));
    const requestedExport = subpath ? manifest.exports?.[`./${subpath}`] : manifest.exports;
    const entry =
      exportEntry(requestedExport) ??
      (!subpath ? (manifest.module ?? manifest.main ?? "index.js") : null);
    if (!entry) return null;
    const entryPath = join(packageDir, entry);
    return existsSync(entryPath) ? entryPath : null;
  } catch {
    return null;
  }
}

function exportEntry(exports) {
  const root =
    typeof exports === "object" && exports !== null ? (exports["."] ?? exports) : exports;
  if (typeof root === "string") return root;
  if (typeof root !== "object" || root === null) return null;
  if (typeof root.import === "string") return root.import;
  if (typeof root.default === "string") return root.default;
  if (typeof root.node === "string") return root.node;
  if (typeof root.node === "object" && root.node !== null) {
    return root.node.import ?? root.node.default ?? null;
  }
  return null;
}

function assertPinnedPackageSpecs(packageSpecs) {
  const unpinned = packageSpecs.filter((spec) => !hasVersionSpec(spec));
  if (unpinned.length === 0) return;
  throw new Error(
    [
      `Refusing to bootstrap unpinned package spec(s): ${unpinned.join(", ")}`,
      "Pass pinned npm package specs, for example:",
      `  ${packageSpecs.map((spec) => (hasVersionSpec(spec) ? spec : `${spec}@<version>`)).join(" ")}`,
    ].join("\n"),
  );
}

function hasVersionSpec(packageSpec) {
  if (packageSpec.startsWith("@")) {
    const slash = packageSpec.indexOf("/");
    return slash !== -1 && packageSpec.indexOf("@", slash + 1) !== -1;
  }
  return packageSpec.includes("@");
}

async function confirmBootstrap(packageSpecs) {
  if (process.env[BOOTSTRAP_CONFIRM_ENV] === "1") return;

  const installLine = `npm install --ignore-scripts --no-save ${packageSpecs.map(shellQuote).join(" ")}`;
  if (!process.stdin.isTTY) {
    throw new Error(
      [
        "Required helper package(s) are missing.",
        "To allow a one-time temporary dependency bootstrap for this run, set:",
        `  ${BOOTSTRAP_CONFIRM_ENV}=1`,
        "The bootstrap command will be:",
        `  ${installLine}`,
      ].join("\n"),
    );
  }

  const rl = createInterface({ input: process.stdin, output: process.stderr });
  try {
    const answer = await rl.question(
      [
        "HyperFrames helper package(s) are missing.",
        `Run a temporary install with lifecycle scripts disabled?`,
        `  ${installLine}`,
        "Proceed? [y/N] ",
      ].join("\n"),
    );
    if (!/^(y|yes)$/i.test(answer.trim())) {
      throw new Error("Dependency bootstrap cancelled.");
    }
  } finally {
    rl.close();
  }
}

function ancestors(start) {
  const dirs = [];
  let current = resolve(start);
  const root = parse(current).root;
  while (current && current !== root) {
    dirs.push(current);
    current = dirname(current);
  }
  dirs.push(root);
  return dirs;
}

function bootstrapWithNpmInstall(packageNames) {
  const installRoot = mkdtempSync(join(tmpdir(), "hyperframes-skill-deps-"));
  const installResult = spawnSync(
    process.platform === "win32" ? "npm.cmd" : "npm",
    [
      "install",
      "--silent",
      "--no-audit",
      "--no-fund",
      "--ignore-scripts",
      "--no-save",
      "--prefix",
      installRoot,
      ...packageNames,
    ],
    { stdio: "inherit" },
  );

  if (installResult.error) throw installResult.error;
  if (installResult.status !== 0) {
    rmSync(installRoot, { recursive: true, force: true });
    process.exit(installResult.status ?? 1);
  }

  const args = [...process.argv.slice(1)];
  const result = spawnSync(process.execPath, args, {
    stdio: "inherit",
    env: {
      ...process.env,
      [BOOTSTRAP_ENV]: "1",
      [NODE_MODULES_ENV]: join(installRoot, "node_modules"),
    },
  });

  rmSync(installRoot, { recursive: true, force: true });
  if (result.error) throw result.error;
  process.exit(result.status ?? 1);
}

function shellQuote(value) {
  if (/^[A-Za-z0-9_./:@=-]+$/.test(value)) return value;
  return `'${value.replace(/'/g, "'\\''")}'`;
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 467kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 193kUpdated Claude CodeCodexVerifiedInstall