Add Mouse Driven Orbit logo

Add Mouse Driven Orbit

CommunityPopular
MengTo
add-mouse-driven-orbit

Add restrained mouse-driven orbit and parallax depth to a Three.js hero by damping one pointer target and splitting it across camera translation, look-at, and small object rotations. Use for passive cinematic 3D heroes, pointer-responsive scenes, organic model parallax, and interactive depth where OrbitControls would feel like a product viewer.

Overview

PublisherMengTo
RepositorySkills
Skill nameadd-mouse-driven-orbit
Stars
6.1K
Forks
717
Bundled files
7
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by MengTo on GitHub. Read the source before you install it.

Installation

Install the Add Mouse Driven Orbit AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MengTo/Skills.git /tmp/Skills
mkdir -p .claude/skills
cp -r /tmp/Skills/agent-skills/web-design/add-mouse-driven-orbit .claude/skills/add-mouse-driven-orbit
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Add Mouse Driven Orbit in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Add Mouse Driven Orbit on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Add Mouse Driven Orbit is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Add Mouse-Driven Orbit

Turn one damped pointer target into a shallow camera arc and smaller object rotations. Reach for threejs with OrbitControls when the user must inspect a product directly; reach for build-game-camera-controls for drag, zoom, occlusion, or gameplay cameras. This Skill is passive cinematic depth, not direct manipulation.

Extracted from inner-green-3d.html, where a procedural moss root had to turn toward the pointer without sliding away from the headline, cards, and pinned silhouette landmarks.

Record intent, not layout

In the pointer handler, write normalized coordinates only:

js
function recordPointer(event) {
  if (event.pointerType === "touch") return;
  target.x = (event.clientX / viewport.width) * 2 - 1;
  target.y = (event.clientY / viewport.height) * 2 - 1;
}

Cache the interactive rectangle from ResizeObserver. Do not call getBoundingClientRect() for every layer on every pointermove; synchronous layout turns a light effect into frame spikes.

On pointerleave, set the target back to 0, 0. On coarse pointers, keep the authored center pose. Passive orbit should never require touch dragging to reveal content.

Dampen in the frame loop

The source uses 0.055 per 60 Hz frame. Preserve that feel across refresh rates:

js
const alpha = 1 - Math.pow(1 - 0.055, dt * 60);
smooth.x += (target.x - smooth.x) * alpha;
smooth.y += (target.y - smooth.y) * alpha;

Clamp dt to 1/30 s and reset the time base after resume. A fixed per-frame lerp feels heavy at 30 Hz and twitchy at 120 Hz; an unclamped delta jumps after backgrounding.

Stop style or uniform writes once the rounded value settles. Three decimals are finer than one pixel of the landed travel:

js
const x = Math.round(smooth.x * 1000) / 1000;
const y = Math.round(smooth.y * 1000) / 1000;
if (x !== lastX || y !== lastY) publish(x, y);

Split the motion

Use opposing, unequal layers so the scene pivots rather than translates as one slab:

js
camera.position.x = -smooth.x * 26;
camera.position.y =  smooth.y * 16;
camera.lookAt(camera.position.x * 0.42, camera.position.y * 0.42, 0);

nearGroup.rotation.y = smooth.x * 0.055;
nearGroup.rotation.x = smooth.y * 0.026;
farGroup.rotation.y  = smooth.x * 0.030;

Treat these as the landed values for a scene framed in stage-pixel world units:

layerhorizontalverticalreason
camera translation-26+16establishes the shallow arc
camera look-at carry42%42%keeps the subject near its pinned composition
near object yaw0.055 radexposes surface depth without showing its flank
near object pitch0.026 radprevents the top surface from flattening
far object yaw0.030 radseparates planes without matching the foreground

Do not rotate everything by the same amount. Equal movement reads as a flat poster following the cursor. Do not aim the camera at the fixed origin while translating it; the subject visibly slides away from the layout.

Apply CSS parallax from the same smooth pair, but give text and controls smaller depth coefficients than the 3D form. Keep transforms free for parallax; use clip, opacity, or child wrappers for unrelated reveals so animations do not overwrite each other.

Preserve framing across sizes

Build the center pose first at every breakpoint. Recalculate camera aspect and any stage-to-world scale from a ResizeObserver, guard zero-sized roots, then apply orbit offsets. Verify both extreme pointer corners: no copy collision, card clipping, or exposed empty edge.

Use keyboard-operable X and Y range controls in a demo or configurator. They prove the orbit is parameterised and give non-pointer users access to the same authored states. Keep focus visible and announce motion-mode changes.

Respect motion and lifecycle

  • Under prefers-reduced-motion: reduce, render a designed three-quarter still at approximately x=.28, y=-.12; keep the range controls live and redraw their selected still without interpolation.
  • Pause while hidden or offscreen and resume with a reset time base.
  • Cap DPR at 2 and clamp dt to 1/30 s.
  • Keep the canvas decorative unless the 3D object carries information. Preserve all labels and controls in semantic HTML.
  • On teardown, cancel the frame, disconnect observers, remove pointer/media listeners, and dispose Three.js resources.

State the cost honestly

The orbit math is negligible. The expensive work is the scene already being redrawn and any DOM style invalidation layered on top. Share one frame loop, round settled values, avoid layout reads in pointer handlers, and profile the underlying draw before removing the interaction. Moving the camera does not make a dense scene cheaper.

Verify

  • Compare center and four-corner poses with the source at 1440×900.
  • Confirm camera and objects move by different, opposing amounts.
  • Move quickly across the viewport; the scene must ease through the path, not snap.
  • Leave the viewport; confirm a smooth return to center.
  • Test 390×844 and coarse/touch input; center composition remains complete.
  • Tab through X/Y controls, change them with arrow keys, and confirm visible focus.
  • Test ?reduced=1: stable designed still, no autonomous easing, live controls.
  • Hide/show and scroll away/back; confirm no jump and only one frame loop.
  • Confirm a clean console at both sizes.

Use demo/index.html as the working proof and demo/PROMPT.md to recreate or remix it.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Add Mouse Driven Orbit AI skill do?

Add restrained mouse-driven orbit and parallax depth to a Three.js hero by damping one pointer target and splitting it across camera translation, look-at, and small object rotations. Use for passive cinematic 3D heroes, pointer-responsive scenes, organic model parallax, and interactive depth where OrbitControls would feel like a product viewer.

Why use Add Mouse Driven Orbit on TypingMind?

Because you install it once and use it with any model. Add Mouse Driven Orbit is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Add Mouse Driven Orbit in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/MengTo/Skills/tree/main/agent-skills/web-design/add-mouse-driven-orbit. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Add Mouse Driven Orbit?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Add Mouse Driven Orbit?

As many as you like. As long as a model supports skills, you can use Add Mouse Driven Orbit with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Add Mouse Driven Orbit AI skill free?

Yes. It is published on GitHub by MengTo under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇