add-mouse-driven-orbit

Adds damped pointer-driven orbit and parallax depth to Three.js hero scenes.

5.7k|685|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/MengTo/Skills --skill add-mouse-driven-orbit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-mouse-driven-orbit
Source: https://github.com/MengTo/Skills/tree/main/agent-skills/web-design/add-mouse-driven-orbit
Command: npx skills add https://github.com/MengTo/Skills --skill add-mouse-driven-orbit

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three, and includes assets (resource) components.

What problem does it solve?

Three.js hero sections often feel static, but adding OrbitControls turns them into product viewers that fight the page layout. This Skill shows how to add restrained, cinematic pointer-driven depth that enhances a composition without breaking it.

Core Features & Use Cases

  • Damped Pointer Orbit: Records one normalized pointer target and damps it with a refresh-rate-independent 0.055-per-frame lerp, then splits it across camera translation, a 42% carried look-at, and unequal near/far object rotations.
  • Performance & Lifecycle Guardrails: Caches layout via ResizeObserver, rounds settled values to skip redundant writes, caps DPR at 2, clamps dt to 1/30 s, and pauses when hidden or offscreen.
  • Accessibility Support: Ignores touch pointers, returns smoothly to center on pointer leave, provides keyboard-operable X/Y range controls, and renders a designed still under prefers-reduced-motion.
  • Use Case: A landing page hero with a procedural 3D model needs subtle depth as the mouse moves, while the headline, cards, and pinned landmarks stay composed at every breakpoint from 390px to 1440px.

Quick Start

Ask your agent to use the add-mouse-driven-orbit skill to add restrained pointer-driven depth to your Three.js hero without OrbitControls.

Frequently Asked Questions about add-mouse-driven-orbit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add mouse parallax to a Three.js hero scene?

Record a normalized pointer target from pointermove, damp it in the frame loop with a refresh-rate-independent lerp, then split it across camera translation, a partially carried look-at, and small unequal object rotations. This creates depth without breaking the composition.

When should I use pointer orbit instead of OrbitControls in Three.js?

Use passive pointer orbit for cinematic heroes where the camera should enhance a fixed composition. Use OrbitControls when the user must directly inspect a product, and use gameplay camera controls for drag, zoom, or occlusion scenarios.

How do I make lerp damping consistent across refresh rates?

Convert a per-frame factor like 0.055 at 60 Hz into a delta-based alpha: 1 - Math.pow(1 - 0.055, dt * 60). Clamp dt to 1/30 s and reset the time base after the tab is hidden to avoid jumps.

Does pointer parallax work on touch devices?

Passive orbit should ignore touch pointers and keep the authored center pose, since touch users cannot hover. Provide keyboard-operable range controls so non-pointer users can still access the same authored poses.

How do I handle prefers-reduced-motion for WebGL animations?

Render a designed static pose, such as a three-quarter still at fixed x and y values, with no interpolation or autonomous easing. Keep pose controls live so users can select other still frames manually.

Why does my pointermove handler cause frame spikes?

Calling getBoundingClientRect on every pointermove forces synchronous layout. Cache the interactive rectangle from a ResizeObserver instead, and stop style writes once rounded pointer values settle.