PocketPapi

Developer library · 68 free recipes

Effects, ready to ship.

Free motion recipes for real websites. Browse practical CSS and JavaScript patterns, copy a focused implementation, or let an LLM fetch the exact effect through the PocketPapi API or MCP.

const effect = "fade-up-reveal";
await ship(effect);

The foundation

Native recipes

Small, composable patterns you can paste into a plain HTML site, a CMS, or a generated staging build.

Interactive preview
Media & layoutCC0-style snippets

Image zoom frame

A restrained image scale on hover that keeps the crop contained and does not alter the layout.

[data-sc-effect="image-zoom"] { overflow: hidden; }
[data-sc-effect="image-zoom"] img { display: block; width: 100%; transition: transform 350ms ease; }
[data-sc-effect="image-zoom"]:hover img,
[data-sc-effect="image-zoom"]:focus-within img { transform: scale(1.06); }
@media (prefers-reduced-motion: reduce) { [data-sc-effect="image-zoom"] img { transition: none; } }
Interactive preview
Media & layoutCC0-style snippets

Pointer parallax layer

A small pointer-based depth shift for a decorative layer, with touch and reduced-motion fallbacks.

<div data-sc-effect="parallax"><div data-sc-parallax-layer>Focal visual</div></div>
<style>[data-sc-effect="parallax"] { overflow: hidden; } [data-sc-parallax-layer] { transition: transform 180ms ease; }</style>
<script>
const scene = document.querySelector('[data-sc-effect="parallax"]');
const layer = scene.querySelector('[data-sc-parallax-layer]');
scene.addEventListener('pointermove', (event) => {
  const box = scene.getBoundingClientRect();
  const x = (event.clientX - box.left) / box.width - .5;
  const y = (event.clientY - box.top) / box.height - .5;
  layer.style.transform = `translate3d(${x * 12}px, ${y * 12}px, 0)`;
}, { passive: true });
scene.addEventListener('pointerleave', () => { layer.style.transform = ''; });
Interactive preview
Media & layoutCC0-style snippets

Image reveal wipe

Reveal an image from a clipped color block with a simple CSS mask and no asset dependency in the demo.

[data-sc-effect="image-reveal-wipe"] { overflow: hidden; clip-path: inset(0 100% 0 0); animation: sc-image-reveal 850ms cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes sc-image-reveal { to { clip-path: inset(0); } }
@media (prefers-reduced-motion: reduce) { [data-sc-effect="image-reveal-wipe"] { clip-path: inset(0); animation: none; } }
Interactive preview
Media & layoutCC0-style snippets

Video hover preview

Preview a muted video or motion frame only after an explicit interaction, with a still-image fallback.

[data-sc-effect="video-hover-preview"] { position: relative; overflow: hidden; }
[data-sc-effect="video-hover-preview"] video { display: block; width: 100%; }
[data-sc-effect="video-hover-preview"] [data-video-play] { position: absolute; inset: auto .75rem .75rem auto; }
@media (prefers-reduced-motion: reduce) { [data-sc-effect="video-hover-preview"] video { animation: none; } }

const videoRoot = document.querySelector('[data-sc-effect="video-hover-preview"]'); const video = videoRoot.querySelector('video'); videoRoot.addEventListener('pointerenter', () => { if (!matchMedia('(prefers-reduced-motion: reduce)').matches) video.play(); }); videoRoot.addEventListener('pointerleave', () => video.pause());
Interactive preview
Media & layoutCC0-style snippets

Video cinema stage

Adds an approved project-library video as a lazy, muted cinematic section background with a poster fallback and soft atmospheric overlay.

/* CSS */
[data-sc-effect="video-cinema-stage"] { position: relative; isolation: isolate; overflow: hidden; background: #101522; }
[data-sc-effect="video-cinema-stage"] > video.site-studio-motion-background { position: absolute; z-index: -1; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(.86) contrast(1.08) brightness(.64); }

/* JS */
document.querySelectorAll('[data-sc-effect="video-cinema-stage"]').forEach((scene) => {
  const video = scene.querySelector(':scope > video.site-studio-motion-background');
  if (!video) return;
  const motionSetting = getComputedStyle(scene).getPropertyValue('--sc-respect-reduced-motion').trim();
  const media = window.matchMedia('(prefers-reduced-motion: reduce)');
  const connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
  let visible = false;
  let scheduled = false;
  let idleId = 0;
  let fallbackTimer = 0;
  let loadHandler = null;
  const motionAllowed = () => motionSetting === '0' || !media.matches;
  const canPlay = () => visible && !document.hidden && motionAllowed() && !(connection && (connection.saveData || ['slow-2g', '2g'].includes(connection.effectiveType)));
  const stop = () => video.pause();
  const cancelStart = () => {
    scheduled = false;
    if (idleId && 'cancelIdleCallback' in window) window.cancelIdleCallback(idleId);
    if (fallbackTimer) window.clearTimeout(fallbackTimer);
    if (loadHandler) window.removeEventListener('load', loadHandler);
    idleId = 0; fallbackTimer = 0; loadHandler = null;
  };
  const start = () => {
    scheduled = false; idleId = 0; fallbackTimer = 0; loadHandler = null;
    if (!canPlay()) { stop(); return; }
    video.muted = true; video.loop = true; video.playsInline = true;
    if (!video.src && video.dataset.siteStudioSrc) { video.src = video.dataset.siteStudioSrc; video.load(); }
    const attempt = video.play();
    if (attempt && typeof attempt.catch === 'function') attempt.catch(() => {});
  };
  const scheduleStart = () => {
    if (scheduled || !canPlay()) return;
    scheduled = true;
    const afterLoad = () => {
      loadHandler = null;
      if (!scheduled) return;
      if ('requestIdleCallback' in window) idleId = window.requestIdleCallback(start, { timeout: 3000 });
      else fallbackTimer = window.setTimeout(start, 1200);
    };
    if (document.readyState === 'complete') afterLoad();
    else { loadHandler = afterLoad; window.addEventListener('load', loadHandler, { once: true }); }
  };
  if ('IntersectionObserver' in window) {
    const observer = new IntersectionObserver((entries) => entries.forEach((entry) => { visible = entry.isIntersecting; if (visible) scheduleStart(); else { cancelStart(); stop(); } }), { threshold: 0.01 });
    observer.observe(scene);
  } else { visible = true; scheduleStart(); }
  const motionChanged = () => {
    if (!motionAllowed()) { cancelStart(); stop(); if (video.hasAttribute('src')) { video.removeAttribute('src'); video.load(); } }
    else scheduleStart();
  };
  media.addEventListener ? media.addEventListener('change', motionChanged) : media.addListener(motionChanged);
  if (connection && connection.addEventListener) connection.addEventListener('change', () => { if (canPlay()) scheduleStart(); else { cancelStart(); stop(); } });
  document.addEventListener('visibilitychange', () => { if (document.hidden) { cancelStart(); stop(); } else scheduleStart(); });
});

Bring a library when it earns its weight

Free library starters

Version-pinned starting points for open-source libraries. Review the license and performance tradeoff before adding another dependency.

For GPTs and other agents

Tell the LLM how to use the library.

Give the model a clear selection loop. It should discover, fetch, compose, then explain where it placed the effect instead of inventing a new dependency.

Recommended instruction

Use this in a system or developer prompt when the model can access the REST API or MCP.

When a user asks for website motion or an interaction effect:
1. Search PocketPapi’s effects catalog before writing a new animation.
2. Prefer a native recipe when it meets the request; use a free MIT library only when it materially reduces complexity.
3. Fetch the chosen effect by effect_id and inspect its reduced-motion and accessibility notes.
4. Read `studio_compatibility` before choosing an effect. `available=true` means Site Studio can stage it on one unique existing element; `available=false` means it is copy-code/MCP composition only and needs markup or reviewed dependency setup.
5. For a connected site, use `sitecommander_site_studio_media` with `media_type=video` to find an approved MP4/WebM and `media_type=poster` for an optional still image, then call `sitecommander_site_studio_effect_apply` with the exact staged page, unique selector, and chosen animation settings. This returns a review preview and never publishes. Authorized REST clients can use `/api/control-plane/site-studio/media` and `/api/control-plane/site-studio/effects` with the same site scope.
6. For standalone code, compose the effect for the user’s real selector. Keep the selector scoped and do not rewrite unrelated styles.
7. Return the exact files or insertion points, explain the dependency (if any), and mention keyboard, touch, and prefers-reduced-motion behavior.
8. Never add a library from an untrusted CDN or use a versionless URL when a pinned URL is available.

Use `sitecommander_effects_search`, `sitecommander_effects_fetch`, and `sitecommander_effects_compose` for discovery and code. Use `sitecommander_site_studio_media` plus `sitecommander_site_studio_effect_apply` only for an authorized site's staging workflow.
Public catalog, connected-site staging.The REST endpoints are public and read-only. An authorized MCP site connection can stage compatible effects for review; publishing remains a separate approval.