# targets
The touchTargetsKit front door: `require("touchTargetsKit.targets")`. `start`/`stop` recognition on this client, `add`/`remove` targets, and listen with `onHit` (every peer, once per resolved hit), `onMiss`, `onHoldProgress` and `onDrag` (local). It reads touches (`Zin.touch.slots()`) and the mouse each frame, tests them against every target's projected screen circle (fingertip-sized minimum radius), turns gestures (tap, doubleTap, hold, swipe, drag, any) into claims, resolves claims on the target's authority (its owner, else the host) over `multiplayer.send`, broadcasts hits, plays reactions and draws hold rings and highlights through the overlay. Game code and the TouchTarget component call it; the package README documents every call.
# gallery
A demo for touchTargetsKit: `require("touchTargetsKit.gallery").spawn(opts)` in play spawns one tap target per reaction (pop, shatter, squash, spinAway, fade, sparkle, none) and one hold target per hold ring (ring, fill, petals, segments, dots), laid across the screen in front of the camera (or around `opts.origin`), respawning a second and a half after each hit. Options: look, origin, spacing, size, distance, holdSeconds, synced (host spawns synced entities), respawn. `clear()` removes them.
# stage
Starfall Garden's layout numbers in one place: the sky preset, the garden island, the distant islets, the vertical play field things fall through, the fixed camera and the five garden flowers. The scene build (`scenes/main.scene/build.luau`) and the game modules both read it so they always agree.
# feedback
The fingertipKit front door: `require("fingertipKit.feedback")`. `start(opts)` puts up one non-interactive overlay screen on this player's peer and polls the player's own touches (and the left mouse button) every frame: a finger landing plays a tap ripple and the look's tap sound, a moving finger leaves a trail, and the kit's recogniser reports tap, doubleTap, hold, swipe, flick, drag and pinch (`onGesture`), which also dismiss the matching gesture hints. It holds the settings (look and per-style overrides), builds look-styled buttons (`button`, `pressStyle`), shows hints (`hint`, `hintOnce` with per-player memory, `clearHints`, `resetHints`), manual ripples (`ripple`), scripted ghost fingers (`virtualTouch`) and test counters (`stats`). Game code, the TouchFeedback component and the gallery call it; the package README documents every call.
# round
The round of Starfall Garden, assembled from the installed kits: skyfallKit drops stars, gloom wisps and seed pods in waves; touchTargetsKit turns a tap, a swipe or a hold on them into a catch; scoreKit scores and combos; MatchFlow runs one shared 90-second round with a 3-2-1-GO; menusKit shows the title, victory and game-over screens with Play again; juiceKit shakes and sparkles; fingertipKit draws every finger and teaches each gesture on the first play. It keeps only the game's own rules: points per kind, the shared moon meter and Moonburst (double tap), gloom that lands wilting a flower, pods that revive one.
# touchTargetsKit
**Make 3D objects tappable, double-tappable, holdable, swipeable (slice through them) and draggable on touch screens, with forgiving fingertip-sized hit circles, hit reactions, hold-progress rings and highlights, and one winner per target in multiplayer.**
Version **1.0.1** (`TT.VERSION`). The version, this README and `package.yaml` move together.
## Install
1. Search ZeroMind for **touchTargetsKit** and install `touchTargetsKit.package`, or install it by its guid once published (`zeromind_install guid=<touchTargetsKit guid>`). It depends on **juiceKit** (hit particles), which the install brings along.
2. `local TT = require("touchTargetsKit.targets")` from any component or module that runs in play.
3. `TT.start()` once, then `TT.add(entity, { gestures = "tap" })` for each object.
Or with no code: put the **TouchTarget** component on an entity and set its fields.
## Quick start
```lua
local TT = require("touchTargetsKit.targets")
TT.start({ look = "neon" }) -- once per client; safe to call again
-- a small star you tap
TT.add(star, { gestures = "tap", radius = 0.3, kind = "star", points = 10, reaction = "sparkle" })
-- a wisp you slice by swiping through it
TT.add(wisp, { gestures = "swipe", radius = 0.5, kind = "wisp", points = 25, reaction = "shatter" })
-- a seed pod you hold for a second
TT.add(pod, { gestures = "hold", holdSeconds = 1.0, radius = 0.6, kind = "pod", holdRing = "petals", reaction = "pop" })
-- a crate you drag, which stays (consume = false)
TT.add(crate, { gestures = "drag", radius = 0.5, consume = false })
TT.onHit(function(ev) -- every peer, once per hit
if ev.isLocal then score += ev.points end
end)
TT.onMiss(function(ev) -- this client only
if ev.reason == "wrongGesture" then showHint(ev.entity, ev.gesture) end
end)
TT.onDrag(function(ev) -- this client only
if ev.phase == "move" then crate.position = { ev.position.x, ev.position.y, ev.position.z } end
end)
```
`require("touchTargetsKit.gallery").spawn()` in play spawns a row of every reaction (tap them) and every hold ring (hold them) in front of the camera.
## How touches are recognised
- Each client recognises its own fingers against every target's **screen position** (`worldToScreen`, scene viewport physical pixels, the space of `Zin.touch.slots()`). The mouse is one more finger while no touch is down.
- A target's hit circle is its projected radius times 1.15, but **never smaller than `minRadius` logical points** (default 44, times `ui.pixelRatio()`), so a tiny, far or fast object is still easy to hit. Overlapping circles go to the one the finger is most central in.
- **tap**: lift within the slop (22 pt). A long press on a tap target still counts (forgiving). **doubleTap**: two taps within 0.32 s; a target that takes both tap and doubleTap waits out the window before a single tap. **hold**: keep the finger on it for `holdSeconds`; the finger may wobble up to 1.4 hit radii; the hold ring shows the progress. **swipe**: a finger moving faster than 380 pt/s slices every swipe target whose circle the segment between two consecutive samples crosses, during the move, so a fast swipe never skips one. **drag**: the finger grabs it once it leaves the slop; `onDrag` reports `begin`/`move`/`end` with the finger's point on a plane (`dragPlane = "view"`, facing the camera through the object, or `"ground"`, horizontal) and `position`, where the object goes keeping the grab offset. **any**: tap, doubleTap (as a tap), hold and swipe all hit it.
- A tap on a target that needs another gesture, or a swipe that crosses only non-swipe targets, is a `miss` with `reason = "wrongGesture"` and the entity; a gesture over nothing is `reason = "empty"`.
- Each target's circle is stated as a touch region the kit holds (`input.setTouchClaims`), so a finger that lands on a target belongs to the game even inside the on-screen look area. Contacts on an on-screen button are left alone. `TT.config.claimTouches = false` turns this off.
## Styles
Every style is one setting per target (or per `TT.add` call); `look` is global.
| Setting | Values |
|---|---|
| `reaction` (on hit) | `pop`, `shatter`, `squash`, `spinAway`, `fade`, `sparkle`, `none` |
| `holdRing` (hold progress) | `ring`, `fill`, `petals`, `segments`, `dots` |
| `highlight` (finger over it) | `glow`, `outline`, `grow`, `none` |
| `look` (`TT.setLook`) | `cartoon`, `minimal`, `neon`, `pixel`, `pastel` |
Rings, highlights and shatter shards are drawn by four pooled instanced draws (no entity per indicator, at most 256 instances each, 48 targets lit at once); reactions animate the entity's transform and play a juiceKit effect in the look's matching juice look. On a mid-range tablet the kit's frame costs a few hundred table writes and four buffer uploads.
## API
```lua
TT.start(opts?) -- idempotent; opts.look, opts.minRadius (logical points, default 44), opts.enabled
TT.stop() -- stop recognising on this client; indicators clear, targets stay registered
TT.add(entity, opts) -> id
-- opts: gestures = "tap" | { "tap", "swipe", ... }, radius = 1.0 (world units), holdSeconds = 0.7,
-- kind = "target", points = 0, reaction = "pop", holdRing = "ring", highlight = "glow",
-- consume = true, data = {}, dragPlane = "view" | "ground", despawn = true,
-- positionOf = function() return {x,y,z} end -- local: where the object is drawn
-- calling add again on the same entity updates it (one target per entity);
-- a target whose entity is despawned is dropped automatically
TT.remove(entityOrId)
TT.onHit(fn, opts?) -- every peer: { entity, id, kind, gesture, player, peer, isLocal, points, data, screenX, screenY, world = {x,y,z} }
-- player = the winner's user id, peer = the winner's peer id (two devices on one account differ by peer)
-- opts.key: registering again under the same key replaces the earlier listener (also onMiss, onHoldProgress, onDrag)
TT.onMiss(fn) -- local: { gesture, screenX, screenY, reason = "empty" | "wrongGesture", entity?, id?, kind?, early? }
TT.onHoldProgress(fn) -- local: { entity, id, progress } (0 when the finger lets go early)
TT.onDrag(fn) -- local: { entity, id, phase = "begin" | "move" | "end", world, position, screenX, screenY }
TT.setLook(name) TT.getLook() TT.looks() TT.reactions() TT.holdRings() TT.highlights() TT.gestures()
TT.setEnabled(bool) TT.isEnabled() TT.isStarted()
TT.get(entityOrId) -- the target's settings and live screen circle
TT.list() TT.stats() TT.config TT.VERSION
```
Every `on*` returns a function that unsubscribes. `id` is the entity's id. `screenX/screenY` in a hit are where the winning player's finger was, on their screen. `player` is the winner's user id. Drag never produces a hit; the game moves the object (from the peer that owns it).
## Multiplayer rules
- **Claims**: the client that saw the gesture sends a claim on `multiplayer.send("touchTargetsKit.claim", ...)`. The **authority** for a target is its owner for a synced entity (`entity:owner()`, `isLocal()`), else the host (`multiplayer.isHost()`), which also covers scene entities every peer builds its own copy of.
- **One winner**: the authority accepts the first claim; a consumed target is dead from then on and later claims are refused; a target that stays (`consume = false`) refuses claims for 0.12 s after a hit. It broadcasts the hit on `touchTargetsKit.hit` with a unique hit id and applies it locally, so `onHit` fires once on every peer, the winner's included (`isLocal = true` there only).
- **Reactions** play on every peer; the transform animation runs on the peer that may write the entity (its owner, or every peer for an unsynced copy) and replicates from there. With `consume = true` that peer despawns the entity when the reaction ends (`despawn = false` hides it instead), and every other peer hides its view.
- **Registration**: `TT.add` on a synced entity this peer owns tells every other peer (`touchTargetsKit.reg`), and a client that starts later asks the owners (`touchTargetsKit.ask`), so the host can spawn synced targets and register them once. Calling `TT.add` on every peer (the TouchTarget component does) works the same.
- **A synced entity that stands still while a local child moves**: call `TT.add(syncedEntity, { positionOf = function() return bodyPos end, ... })` on every peer. Projection, highlights, hold rings, the hit's `world` and the reaction effects use the callback; claims and ids stay keyed by the synced entity, and a consumed one is despawned by its owner. A registration arriving from another peer never clears a callback this peer set.
- **Single player** needs nothing: with no relay the local client is the authority.
- Indicators, highlights, misses, hold progress and drags are local to the player whose finger it is.
## Parts
- `targets.module`: the API above, recognition, claims and drawing of indicators.
- `TouchTarget.component`: the no-code way; its fields are the `TT.add` settings.
- `gallery.module`: `spawn(opts)` / `clear()`, every reaction and hold ring side by side.
- `reactions.module`, `overlay.module`, `styles.module`, `state.module`: the reactions, the pooled instanced draws, the style tables, and the state that survives a hot reload.
- Guides: **How to make 3D objects tappable, swipeable and holdable on touch screens** (`touchTargetsKit.package/how-to-make-3d-objects-tappable-swipeable-and-holdable-on-touch-screens`) and **Example: build a tap-and-slice touch arcade game** (`touchTargetsKit.package/example-build-a-tap-and-slice-touch-arcade-game`).
## Listeners and play sessions
Listeners live in state that outlasts a hot reload and a trip out of play
and back. Each listener is stamped with the play session it was registered
in, and one left over from an earlier session is dropped the next time an
event fires, so a listener a game forgot to unsubscribe can never count a hit
twice. A game that registers its listeners again every round should pass
`{ key = "..." }` so the new one replaces the old.
## Mouse
The left mouse button is one more finger (ignored for `mouseAfterTouch`
seconds after a touch). A mouse sweeps slower than a flicking finger, so a
mouse drag slices at `TT.config.mouseSwipeSpeed` (200 points per second)
instead of `swipeSpeed` (380).
## Changelog
- **1.0.1**: hits carry `peer` (the winner's peer id); `onHit` / `onMiss` / `onHoldProgress` / `onDrag` take `{ key }` to replace an earlier listener; listeners from an earlier play session are dropped instead of firing again; a mouse drag slices at its own, gentler speed (`mouseSwipeSpeed`).
- **1.0.0**: first release.
## Known limits
- A hit arrives after the round trip to the authority (no optimistic reaction on the claimer); the target stops taking claims from that finger while it waits.
- A contact an on-screen control already holds (a button, the movement stick) is not a target finger; a swipe that starts inside the look area and never crosses a target's circle on its first frame can be taken by the look area.
- `grow` scales the entity only on a peer that may write it; elsewhere it shows as a soft halo.
# Starfall Garden
**A co-op touch arcade game for phones, tablets and computers.** Stars fall on
a floating garden island above a sea of clouds. **Tap** a star to catch it,
**swipe** through a thorny gloom wisp before it lands and wilts one of your five
flowers, **hold** a seed pod until it blooms (and revives a flower), and
**double-tap** when the shared moon meter is full for a **Moonburst** that clears
every gloom wisp on screen. A round lasts 90 seconds and ends with a score,
stars and **Play again**. Friends who join play the same garden, each with their
own score, touch feedback and firefly.
Version 1.0.8 (1.0.8: plays on menusKit 1.4.5, which brings controlsKit 1.4.9, both released without the deleted zui UI library, no code change; 1.0.7: plays on skyfallKit 1.0.4 and spawnerKit 1.2.7, whose README and version label now match, no code change; 1.0.6: plays on skyfallKit 1.0.3, which runs on spawnerKit 1.2.5, so every pooled object waits fully asleep; 1.0.5: installing the game now brings every kit it plays with, listed under Dependencies below, and it runs on the current built-in library; 1.0.4: one award per catch, each player's score on their own badge even when two devices share an account, a round plays through by mouse as well as by touch, the Touch styles room laid out clear of the bar and badge with every tap target visible, and the touch feedback kit renamed to Fingertip (fingertipKit) with its seventh gesture hint, flick; 1.0.3: the Touch styles room, a showcase of every touch feedback style and tap-target reaction, opened from the title; 1.0.2: one shared Match and one scoreKit keeper held in the scene so a second player never creates a duplicate, players can join a round in progress, points and Moonburst bonuses awarded once by the keeper, firefly look built only on live bodies; 1.0.1: cloud sea and cloud floor under the island, cover image; 1.0.0: first release).
## Play it
Open the world *Starfall Garden* and press Play (or Play on the title screen).
The first time each gesture is needed, a little hand shows it.
## Touch styles room
Pick **Touch styles** on the title screen to see and try every touch style side by side: every tap ripple, finger trail, button press and gesture hint (fingertipKit), and every hit reaction and hold ring on 3D objects (touchTargetsKit), each in five looks. It opens over the running garden (`scenes.touchShowcase`, the `TouchShowcase` component), so you stay in the shared world, and **Back to the garden** returns to the title.
## Progression
Lifetime stars are saved per player and earn gardener ranks: Seedling, Sprout,
Bud, Bloom, Starcatcher, Moon Gardener. Each rank unlocks a new finger trail
(sparkles, ribbon, bubbles, comet, chalk, neon). Your best score shows on the
title screen.
## On tablets: 30 frames a second
On a tablet the game runs at **30 frames a second**, not 60. Measured on an
Android tablet during a round: a steady 33 ms per frame, with the game's own
scripts taking only 1 to 4 ms of it, so the limit is the engine's frame rate on
the device, not the game. What you see: falling stars, finger trails and tap
ripples move a little less smoothly than on a computer. Taps, swipes and holds
are judged the same, nothing is missed and scores are not affected. This is
tracked as issue **#26161**; when it is fixed, tablets get the higher frame
rate with no change to the game.
## Dependencies
Installing starfallGarden brings every kit it plays with (declared under
`dependencies` in `package.yaml`), so one install is enough:
| Kit | Version |
|---|---|
| fingertipKit | 1.1.1 |
| touchTargetsKit | 1.0.1 |
| skyfallKit | 1.0.4 (brings spawnerKit 1.2.7) |
| scoreKit | 1.6.0 |
| MatchFlow | 1.4.3 |
| menusKit | 1.4.5 (brings controlsKit 1.4.9) |
| juiceKit | 1.2.16 |
The sky (paintedSkies) and the islands (floatingIslands) are placed by the
world's scene, not by the package's code, so they are not package dependencies.
## What it is made of
It is assembled from installable kits; the package itself holds only the rules
and the look that make it this game.
| Part | Does |
|---|---|
| fingertipKit | tap ripples, finger trails, button press, first-play gesture hints |
| touchTargetsKit | tap / swipe / hold on 3D objects, one winner per object in multiplayer |
| skyfallKit | stars, gloom and pods falling in waves, smooth on every screen |
| scoreKit | points, popups, combos |
| MatchFlow | shared countdown, 90 s round, round end for everyone |
| menusKit | title, victory and game-over screens (cozy look) |
| juiceKit | shake, sparkles, confetti |
| paintedSkies, floatingIslands | the summer sky and the meadow islands |
Inside the package: `round` (the rules), `art` (stars, gloom, pods, flowers in
code), `hud` (flowers and moon meter), `progress` (saved ranks and unlocks),
`sounds` (generated music and effects), `stage` (layout numbers), `game` and the
`StarfallGame` and `Firefly` components. The guide
**How Starfall Garden was put together from installable parts** walks through
it.
## Multiplayer
Every player who opens the world plays the same garden:
- **Shared, exactly once:** the Match (round clock), the scoreKit keeper and the `StarfallGame` entity are placed by the scene, so there is one of each however many players join. The skyfallKit director is created only by the host. Falling objects are synced and every screen computes their motion.
- **Owned by one machine each:** the game entity's owner writes the wilted flowers and the moon meter, scoreKit's keeper awards every point, and the director's owner spawns. A hit is recognised on the finger's own screen and claimed once (touchTargetsKit), so it scores once.
- **Your own:** score display and popups, combo, touch feedback, gesture hints, HUD, menus, sounds, progression and firefly.
- **Joining late:** press Play on the title and you join the round already running. Play again from anyone's end screen starts the next round for everyone.
## Settings
On the `StarfallGame` entity: `roundSeconds` (90), `gardenLives` (5) and
`look` (`pastel`; any fingertipKit / touchTargetsKit look: cartoon,
minimal, neon, pixel, pastel). The waves are `round.SCHEDULE`.
# Fingertip: Touch Feedback and Gesture Hints Kit (fingertipKit)
Touch feedback for phone and tablet games. Installing it gives a world:
- **Tap ripples** wherever a finger lands.
- **Finger trails** that follow every moving finger (multi-touch) or a mouse drag.
- **Button press effects** for the game's own UI buttons, plus a helper that builds a ready button (at least 64 points) with the effect applied.
- **Animated gesture hints**: a little SVG hand that shows the player what to do (tap, double tap, hold, swipe, flick, drag, pinch: seven gestures), shows only the first time if you want, and goes away by itself when the player does the gesture.
- **Five looks** that switch all of the above, a colour palette and a soft tap sound with one setting.
Everything is drawn on one overlay screen of the player's own peer. The overlay **never takes a touch** (every node is `pointerEvents = "none"`, the hand pictures are background images and captions are a non-interactive canvas), the **left mouse button acts as a finger** on desktop, and in **multiplayer every player sees only their own fingers** and hints.
Version **1.1.1**.
**What is in it, by count:** 7 tap ripples, 7 finger trails, 4 button press effects, 4 hint hands, 7 gesture hints (tap, doubleTap, hold, swipe, flick, drag, pinch) and 5 looks (cartoon, minimal, neon, pixel, pastel) that restyle all of them at once. `TF.ripples()`, `TF.trails()`, `TF.presses()`, `TF.hands()`, `TF.hintKinds()` and `TF.looks()` list them.
**Changelog**
- **1.1.1**: runs on the current built-in library (its sound references are pinned to the 2026-11-22 builtin release); no change in behaviour.
- **1.1.0**: renamed from touchFeedbackKit to fingertipKit ("Fingertip: Touch Feedback and Gesture Hints Kit"): `require("fingertipKit.feedback")`, components `fingertipKit.TouchFeedback` and `fingertipKit.TouchFeedbackGallery`. New **flick** gesture hint (a short, quick throw in a direction: a faster, shorter hand stroke with speed lines) and a flick recogniser (`TF.onGesture` reports `flick` with `dir` and `speed` for a swipe released within 0.25 s at 600+ points per second; it still reports `swipe` too). The gallery lays out every section with its own heading row and labels inside their cells, and takes `insetBottom` to keep a strip free for the host's own UI.
- **1.0.0**: first release (as touchFeedbackKit).
## Install
Search ZeroMind for **fingertipKit** (or "tap ripple", "gesture hint hand") and install the package by its guid with `zeromind.install`; it lands at `/source/fingertipKit.package`.
## Quick start
No code: add the **TouchFeedback** component to any entity in your scene and pick a `look`. In play every player gets ripples, trails and the look's sound.
In code:
```lua
local TF = require("fingertipKit.feedback")
TF.start({ look = "pastel" }) -- idempotent, local player only
-- teach a gesture the first time this player plays (saved per player)
TF.hintOnce("jump", "swipe", { x = 0.5, y = 0.75, frac = true, dir = "up", caption = "Swipe up to jump" })
-- a menu button with the look's press effect; the click arrives in the
-- onCallback of the component that registers the screen
ui.registerScreen("menu", { type = "vertical", style = { alignItems = "center", padding = 24 }, children = {
TF.button({ id = "playBtn", text = "Play", icon = "▶", onClick = "play" }),
} })
```
Call `TF.start` from a component hook or plain code (not after a `task.wait`): it also prepares the local sound voices, which need a live component context.
## Looks
| look | ripple | trail | press | hand | sound | palette |
|---|---|---|---|---|---|---|
| `cartoon` | starBurst | comet | pop | cartoonGlove | pop | sunny yellow, red, sky blue, ink outlines |
| `minimal` | ring | ribbon | pushDown | minimalDot | tick | white and calm blue |
| `neon` (sci-fi) | softGlow | neon | glow | outlinedFinger | blip | cyan, magenta, violet glow |
| `pixel` | pixelSquare | pixels | pushDown | pixelHand | chip | 8-bit yellow, red, blue, monospace |
| `pastel` (cozy) | splash | sparkles | wobble | cartoonGlove | bell | pink, mint, lavender |
Any individual setting overrides the look's pick (`TF.start({ look = "neon", trail = "bubbles" })`, `TF.setRipple("inkBlot")`; `nil` goes back to the look's).
## Every style
- **Ripples** (`ripple`): `ring`, `splash`, `starBurst`, `inkBlot`, `pixelSquare`, `softGlow`, `confetti`.
- **Trails** (`trail`): `ribbon`, `sparkles`, `comet`, `chalk`, `neon`, `bubbles`, `pixels`.
- **Press effects** (`press`): `pop`, `glow`, `wobble`, `pushDown`.
- **Hands** (`hand`): `cartoonGlove`, `minimalDot`, `outlinedFinger`, `pixelHand` (SVG pictures in `hands/`).
- **Hint kinds**: `tap`, `doubleTap`, `hold`, `swipe` (dir `left`/`right`/`up`/`down`), `drag` (A to B), `pinch` (dir `in`/`out`).
- **Tap sounds**: `pop`, `tick`, `blip`, `chip`, `bell` (synthesised, in `sounds/`; `sound = false` turns them off).
## API
```lua
local TF = require("fingertipKit.feedback")
TF.VERSION -- "1.1.1"
TF.start(opts?) TF.stop() TF.running()
-- opts: look, ripple, trail, press, hand, sound (bool), volume (0..1), layer (900),
-- scale (1), ripples (bool), trails (bool), mouse (bool), controls (bool),
-- edit (bool: also run in edit mode). TF.start() with no table keeps the current settings.
TF.setLook(name) TF.setRipple(style) TF.setTrail(style) TF.setPress(style) TF.setHand(style)
TF.setSound(on, volume?)
TF.looks() TF.ripples() TF.trails() TF.presses() TF.hands() TF.hintKinds()
TF.settings() -- current settings + what the look resolves to
TF.ripple(x, y, opts?) -- manual ripple at a UI logical point; opts.style/color/scale
TF.button({ id, text, icon?, onClick, style?, width?, height?, press?, fontSize? }) -> node
TF.pressStyle(baseStyle, pressName?) -> style -- adds hover/active states + transition
local h = TF.hint(kind, { x, y, frac?, world?, dir?, toX?, toY?, caption?, timeout?, hand?, scale? })
h:stop() h:isActive()
TF.hintOnce(key, kind, opts) -> handle? -- nil when this player has already seen it
TF.resetHints() TF.clearHints()
TF.onGesture(fn(kind, info)) -> unsubscribe -- tap, doubleTap, hold, swipe, flick, drag, pinch
TF.virtualTouch(key, x, y, opts?) TF.virtualRelease(key) -- a scripted "ghost" finger
TF.stats() -- counters: contacts, ripples, trails, gestures, hints, rebuild cost
```
Coordinates are UI logical points in `ui.screenSize()` space (what `ui.fromViewport` returns). With `frac = true`, `x`, `y`, `toX`, `toY` are 0..1 of the screen. `world = {x, y, z}` makes a hint follow a world position through `worldToScreen` (then `toX`/`toY` are an offset added to the projected point). A hint's `timeout` defaults to 12 seconds (`0` keeps it until it is performed or stopped). Hints are dismissed by the matching gesture anywhere on screen: a `tap` hint by a tap or double tap, a `swipe` hint by a swipe in its `dir`, a `drag` hint by a drag (or swipe) ending within 100 points of its target, a `pinch` hint by a pinch in its `dir`.
`hintOnce` remembers what each player has seen in that player's saved data (`runtime_data.player(localId)` under `fingertipKit/hints/<key>`), falling back to this session when the player has no id.
## Parts
- `feedback` module: the API above; one overlay screen, a per-frame input poll (`Zin.touch.slots()` plus the left mouse button), gesture recognition, hints, persistence.
- `looks` module: the five looks, palettes and colour helpers.
- `fx` module: builds the ripple and trail nodes.
- `hints` module: builds the hint nodes and resolves the hand pictures.
- `sound` module: synthesises (`Sound.bake()`, authoring) and plays the tap sounds on local voices.
- `TouchFeedback` component: zero-code start (fields `look`, `ripple`, `trail`, `press`, `hand`, `sound`).
- `TouchFeedbackGallery` component: a live showcase of every look, ripple, trail, press effect and hint, with look buttons. Put it on an entity and press play.
- Guides: `how-to-show-where-the-player-touched-the-screen-and-teach-gestures` and `example-build-a-small-touch-game-with-tap-ripples-and-gesture-hints`.
## Multiplayer
The kit is purely local: each peer reads its own touches and draws on its own screen, and nothing is replicated. Every player in the world gets their own feedback, sees only their own fingers, and `hintOnce` is remembered per player. Put the `TouchFeedback` component in the scene (it runs on every peer) or call `TF.start` from code that runs on every peer.
## Performance
The overlay is one screen whose tree changes only when an effect starts or ends; every effect animates with a CSS `animation`, so nothing is re-laid-out per frame for motion. Live effects are capped (12 ripples, 64 trail particles), trail particles are spaced by distance and limited to the frame rate, and world-following hints are only rebuilt when they move. Measured on an Android tablet with two fingers dragging: about 0.07 ms of Luau per frame for the poll and 0.1 to 0.4 ms for a tree update.
## Known limits
- Effects draw in the camera's picture (the game view), so in the editor they appear inside the Scene panel, and on screens with an on-screen look zone a finger held by that zone still gets feedback (set `controls = false` to skip contacts any on-screen control holds).
- Gesture recognition is the kit's own simple recogniser (thresholds in logical points); use `Zin.gestures` if your game needs finer control, and `TF.onGesture` if you want to react to what the kit recognised.