npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cricket-pose-tracker

v0.1.0

Published

Browser pose-tracking toolkit: MediaPipe Pose detector wrapper, One Euro landmark smoothing, joint-angle math, and camera framing hints. Built for cricket coaching, useful for any sport.

Readme

cricket-pose-tracker

Browser pose-tracking toolkit extracted from Cricket Shadow Coach. Wraps MediaPipe Pose with a simple detector API and ships the supporting math you need for real-time sport motion analysis: One Euro landmark smoothing, joint-angle calculation, and camera-framing hints.

Built for cricket coaching — works for any sport or movement app that tracks a single person.

Install

npm install cricket-pose-tracker

Zero npm dependencies. MediaPipe Pose (~5 MB of model files) is loaded at runtime from the jsDelivr CDN, so the detector requires a browser environment and network access on first use. The math utilities (PoseSmoother, calculateAngle, getFramingHint, …) are pure functions and run anywhere, including Node.

Quick start

import {
  createPoseDetector,
  PoseSmoother,
  calculateAngle,
  getFramingHint,
} from 'cricket-pose-tracker';

const video = document.querySelector('video');
const smoother = new PoseSmoother();

const detector = createPoseDetector(video, (landmarks, worldLandmarks) => {
  if (!landmarks) return;

  // Debounce-worthy framing feedback ('' = well framed)
  const hint = getFramingHint(landmarks);

  // Smooth jittery landmarks before doing math on them
  const smoothed = smoother.smooth(worldLandmarks ?? landmarks, performance.now());

  // Elbow angle: shoulder (11) – elbow (13) – wrist (15)
  const leftElbow = calculateAngle(smoothed[11], smoothed[13], smoothed[15]);
  console.log({ hint, leftElbow });
});

await detector.start();
// later: detector.stop() or detector.destroy()

API

createPoseDetector(videoElement, onPoseLandmarks, options?)

Creates a detector that pumps video frames through MediaPipe Pose on requestAnimationFrame.

  • onPoseLandmarks(landmarks, worldLandmarks) is called every processed frame with the 33 normalized 2D image landmarks (for drawing) and metric 3D world landmarks (for angle math). World landmarks may be null on some devices — fall back to 2D.
  • options overrides MediaPipe Pose settings (modelComplexity, minDetectionConfidence, …). By default modelComplexity is 0 on mobile and 1 on desktop. The Pose instance is shared, so options apply on first initialization only.
  • Returns { start, stop, destroy }.

new PoseSmoother(minCutoff = 1.0, beta = 0.007)

One Euro filter (Casiez et al., CHI 2012) over a full 33-landmark stream — one filter per landmark per axis. Heavy smoothing at rest, minimal lag during fast motion. Automatically resets after a >500 ms gap (tracking loss).

  • smooth(landmarks, timestampMs) → new array of smoothed {x, y, z, visibility} objects. Visibility passes through unfiltered.
  • reset() clears filter state.

OneEuroFilter is also exported for smoothing single scalar signals.

calculateAngle(a, b, c)

Angle at vertex b formed by 3D points a–b–c, in rounded degrees (0–180). Returns 0 for missing/degenerate input.

calculateSpineTilt(landmarks)

Torso tilt from vertical in degrees, using mid-shoulder and mid-hip of the 33-landmark array.

getFramingHint(landmarks)

Pre-drill camera framing check. Returns a human-readable hint ('Move closer to the camera', 'Step back — make sure your whole body is in frame', …) or '' when the subject is well framed. Pair with the exported FRAMING_HINT_HOLD_MS (800 ms) to debounce hints so they don't flicker.

Landmark indices

Landmarks follow the MediaPipe Pose 33-point topology: 11/12 shoulders, 13/14 elbows, 15/16 wrists, 23/24 hips, 25/26 knees, 27/28 ankles.

License

MIT © Bilal Hasan