/ghibli-threejs:threejs-object-interactionfrom ghibli-threejs
Adds hover/click interaction to a three.js object with raycasting, a pulsing ring, and a cinematic camera sequence that reveals handwriting text on 3D pages with page-flip animation. Use for interactive books, letters, or diaries in WebGL scenes.
Ships in ghibli-threejs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turns one object in the scene into the "hero interaction": a soft glow hints it can be clicked, hover shows a pulsing ring and a pointer cursor, and a click starts one continuous shot (no flash, no cut, no HTML pop-up): the camera glides to a character's eye point, an openable copy of the object lifts overhead and opens, text writes itself onto the pages in handwriting while the camera pushes in, and pages turn with a real hinged leaf. Esc reverses the whole thing back to the saved orbit.
Stack: three.js WebGLRenderer + OrbitControls (vanilla; in R3F put the same logic in useFrame and a ref-held
state object). Proven on three.js r186 with a book resting on a sleeping character's face.
Make
{{object}}in{{entry file}}clickable: a glowing ring on hover. On click, glide the camera into{{character}}'s first-person view, lift and open it, and write{{text}}onto it in handwriting while the camera slowly pushes in. One continuous shot: no flash, no pop-up. Esc reverses it.
- Raycast on
pointermoveusing the canvas rect (not the window). Additive, pulsing, sweeping ring and a pointer cursor. A click counts only if the pointer moved < 6 px sincepointerdown.- The sequence takes camera ownership: disable OrbitControls and skip
controls.update()while it runs.
- Glide (~2.4 s) to the eye point while lerping
camera.uptoward the top of the character's head.- Swap in an openable copy at ~10 % of the glide: two page halves hinged at the spine (bowed page plane + page block + cover each), oriented with
makeBasis(up × down, headDir, down); lift it overhead and rotate the halves from tented (~58°) to nearly flat (~7°).- One
CanvasTexturefor the spread asmapandemissiveMap(~0.5 emissive). Pencil doodle on the left, handwriting ({{web font, e.g. Caveat}}) revealed char by char with an advancing clip rect on the right.- Ease-out dolly to the distance where the spread fills ~85 % of the view, from fov/aspect on both axes.
- Pages from
{{data file}}(pages: [{ text, cite }]), wrapped to page width, spilling past ~9 lines onto extra pages, cite on the last. Fixed characters-per-second; a click mid-sentence finishes the page. Then a hand-written "turn the page ↗" sign + HTML pill; Click / → / Space flips a real leaf toward the reader.- Hide the HUD, show a "close · Esc" pill. Esc / pill / click on the last page reverses it in one shot and restores position, up vector, target and controls.
- Optional: "Let visitors write their own text into the book: up to
{{3}}pages, Enter = new line, refuse anything that would spill past 9 handwritten lines, keep it in the visitor's own browser (localStorage), Reset returns{{data file}}."
references/hover-click-raycast.js)renderer.domElement.getBoundingClientRect() — never innerWidth/innerHeight (breaks as soon as the
canvas isn't full-window or the page scrolls). ray.layers.enableAll() if the object sits on a non-default layer.body.hover<Obj> class for cursor:pointer.pointerup within 6 px of pointerdown; anything more was an orbit drag.RingGeometry(.2, .3, 96) rotated flat, ShaderMaterial additive, depthWrite:false, fog:false:
band = exp(-((r-.235)*40)²) + .35·exp(-((r-.25)*14)²), sweep = .65 + .35·sin(atan(y,x)·3 − t·2.5),
pulse = .8 + .2·sin(t·4), colour warm gold ×2.2. Ease uOn toward 1 (hover), a breathing idle (.28 + .12 sin)
until first use, 0 during the cinematic. Hide it from the AO pass (see threejs-postprocessing-anime-grade).cine flag (false | 'opening' | 'reading' | 'flipping' | 'closing'). While truthy: controls.enabled = false, the render loop skips controls.update() and any ground/waterline clamp, hover is ignored.{ pos, target, up, autoRotate } before, restore exactly after, then controls.update().tweenP(dur, fn, ease)) so the sequence reads as await glide; await write; ….references/openable-book.js)lift > .002 || open > .002
and the original meshes hide at the same moment — the swap happens far from the camera, so it is never seen.PlaneGeometry(W, H, 16, 1) bowed out of the gutter (z = .016·sin(min(1, fromSpine·1.6)·π/2)), u
remapped to its half of the shared spread canvas ([0,.5] or [.5,1]), a page block box and a cover box.makeBasis(cross(headDir, down), headDir, down) so the text reads upright for someone lying down.measureText(line.slice(0, whole)).width + fractional next glyph — a soft pen tip.
Redraw and tex.needsUpdate = true every frame while writing. Wait for document.fonts.load(PAGE_FONT) then
repaint (canvas text doesn't pull web fonts by itself).max((2W·1.18/2)/tan(hfov/2), (H·1.18/2)/tan(vfov/2)), hfov = 2·atan(tan(vfov/2)·aspect).wrapLine splits on spaces; a run wider than the page falls back to character-by-character (URLs, Chinese).skip to finish instantly.u = .5 + (1 − t)·.5, or the doodle lands mirrored.pivot.rotation.y = −a − (π − 2a)·k, bow z = .03·sin(kπ)·sin(x/W·π) on both
planes, 1.15 s ease-in-out. During the flip the static right page is blank and the left keeps the old doodle
until the leaf lands; then redraw and write the next page.references/editable-pages.js){ pages:[{text, cite}], savedAt } under a versioned key; wrap every localStorage access in try/catch.wrapEntry), never a
character count. Refuse overflow by restoring the last good value and caret, and flash the line counter.map is unreadable.#f6ecd4 → #ecdcb8) and bloom threshold above it.Caveat, "Ma Shan Zheng", cursive) downloads for
English readers too, ~200 KB a visit: text drawn before the Latin face lands falls through to it,
document.fonts.load(font) without text loads every family in the stack, and Google slices a CJK font so most
slices carry ASCII as well. Build the font string per language (the CJK family only when that language is on)
and load it for the characters actually painted: document.fonts.load('16px "Ma Shan Zheng"', sample).public/ folder and no framework serves public/ as the root: a root index.html needs
vercel.json "outputDirectory": "."; CLI deploys need .vercelignore alongside .gitignore.pointermove: dispatch PointerEvents on the canvas at CSS
coordinates (the tool's screenshot frame ≠ CSS px). A harmless OrbitControls setPointerCapture exception from
the synthetic pointerdown is expected.threejs-camera-guided-tour · threejs-hud-objective-markers · threejs-night-lights-lanterns (lanterns can carry the visitor's lines) · threejs-postprocessing-anime-grade · threejs-headless-visual-verification
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub nicksonthc/ghibli-threejs --plugin ghibli-threejs31 skills in this plugin
/threejs-blender-glb-pipelineBuilds a reference-image-driven asset pipeline from headless Blender to GLB for a three.js scene — an asset contract (units, axes, grounding, required mesh/material names, budgets, attachment numbers), one parallel subagent per asset group writing craft_<slug>.py generators, preview renders compared against the reference, measured-bounding-box placement in the web scene, Draco compression, and a scored asset quality pass. Use when the user has a reference picture and wants a 3D scene from it, asks to model props/trees/characters in Blender for three.js, export GLBs, fix glTF export issues (vertex-colour alpha, UV flip, axes, custom normals), compress models, or rate and improve every asset in a scene./threejs-boat-buoyancy-steeringFloats a boat (or any buoyant prop) on three.js water with Gerstner waves generated from one JS table that feeds both the GLSL vertex shader and a CPU waveHeight(), four-probe heave/pitch/roll damped springs, an arc-length drift lane that bends round rocks, click-to-steer W/A/S/D rowing with momentum and drag, an autopilot that pursues the lane back, and a chase camera that keeps the orbit. Use when the user wants a drifting or steerable boat, buoyancy, objects bobbing on waves, Gerstner waves on a river/lake, a boat autopilot, or a follow/chase camera behind a vehicle on water./threejs-camera-guided-tourBuilds a hands-free guided camera tour for a three.js scene — keyframes as data, a time-parametrised Catmull-Rom (Hermite) path with continuous velocity, one camera-owner flag, the tour driving time of day and a day→night blend, staged creatures crossing the frame, handwritten captions, portrait-phone lens widening, instant hand-back on drag/scroll/tap/Esc, and a seek() hook for screenshots and video capture. Use when adding a tour mode, cinematic flythrough, attract mode, camera path animation, keyframed camera, spline camera or showcase video capture to a WebGL scene./threejs-cinematic-loading-screenBuilds a cinematic loading gate for a three.js scene — a painted CSS dawn (layered gradients, drifting blurred mist bands, optional conic god rays, SVG feTurbulence grain, vignette), a 2D-canvas layer of falling petals and glowing motes, a handwritten title that animates in, a gold progress line with stage captions, then "tap anywhere to enter" whose tap is the browser gesture that unlocks audio; uses a still captured from the live scene as the backdrop that cross-fades into the real render, and warms up shaders before lifting so the first interaction never stalls. Use when adding a loading screen, splash screen, intro curtain, preloader, tap-to-start / audio unlock gate or shader pre-compilation to a WebGL scene./threejs-day-cycle-lightingAnimates the sun in a three.js scene from sunrise to sunset through a single applySun(az, el) writer — azimuth sweep, elevation arc, warm-to-gold light colour, horizon falloff, warming sky dome and fog, re-aimed god rays and every sun-driven shader uniform — plus a cinematic "sun follows the lens" mode that keeps the sun beside the camera heading for backlit shots with boosted god rays and forward scattering. Use when adding a day/night cycle, time-of-day slider, sunrise/sunset, moving sun, backlit tour shots, or when several systems fight over the sun direction in WebGL/R3F./threejs-dreamy-glass-hudTurns a three.js scene's DOM overlay into one coherent, dreamlike HUD — a single frosted-glass material shared by every pill, badge and popover whose colours are registered CSS properties so the whole HUD cross-fades from pearl to deep indigo as the scene turns to night; an inline-SVG icon dock whose lit toggles glow gold instead of shouting; a glass popover in place of a native select; first-visit hints "whispered" in handwriting that step aside the moment the visitor understands; a HUD that drifts away after half a minute of stillness; a mote of light under each tap; a staggered arrival after the loading gate; and letterbox bars during a camera tour. Use when the overlay UI looks like a dev panel on top of a beautiful scene, when asked for a dreamy, cinematic, premium or 梦幻 / 绝美 UI, glassmorphism, a day/night-aware HUD, onboarding hints, auto-hiding UI, tap feedback, or to restyle lil-gui to match.