Webflow interactivity systems

From vallafederico/webflow-dev-setup · View interactive version

Webflow interactivity systems is an AI agent skill from the GitHub repository vallafederico/webflow-dev-setup. Use observer, scroll tracking, and subscription services for advanced interactivity. Use when implementing scroll animations, viewport detection, or frame-based updates.

How to use this skill

Skill file

Webflow Interactivity Systems

This skill guides you through the specialized systems for viewport detection, scroll progress tracking, and global event subscriptions.

A module that uses onView, Raf.add or GSAP must also call onEditor, so it doesn't run in the Webflow Designer. See Webflow Editor Integration and House Rules.

Viewport & Scroll Tracking

Import from @/modules/_:

`onView` (Viewport Detection)

Triggers a callback when an element enters or leaves the viewport. It doesn't start by itself: pass autoStart: true, or call observer.start() (for example from onMount). It is destroyed in onDestroy for you.

onView(element, {
  threshold: 0.1,
  autoStart: true,
  callback: ({ isIn, direction }) => {
    element.classList.toggle("is-visible", isIn);
  },
});

`onTrack` (Scroll Progress)

Maps scroll progress through an element to a value from 0 to 1. The output is clamped to 0-1, so keep bounds at [0, 1] and scale in the callback.

onTrack(element, {
  bounds: [0, 1], // Map progress to 0-1
  top: "bottom", // Start when the element's top reaches the viewport bottom
  bottom: "top", // End when the element's bottom reaches the viewport top
  callback: (value) => {
    element.style.setProperty("--progress", (value * 100).toString()); // 0-100
  },
});

Global Subscriptions

Import from @lib/subs:

`Raf` (Animation Frame)

For smooth, frame-based updates. Returns an unsubscribe function.

const unsubscribe = Raf.add(({ time, deltaTime }) => {
  // time: seconds since the ticker started. deltaTime: seconds since the last frame
  element.style.transform = `rotate(${time * 50}deg)`;
});
onDestroy(unsubscribe);

`Resize` (Window Resize)

For responsive logic. Returns an unsubscribe function.

const unsubscribe = Resize.add(({ width, height }) => {
  element.classList.toggle("is-mobile", width < 768);
});
onDestroy(unsubscribe);

Priority & Performance

Trigger Point Guide for `onTrack`

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.