RepositoryJavaScriptDEGermany
rawify

rawify/Trackball.js

The RAW library to add a virtual Trackball to your DOM

50stars
3forks
0issues
3views

🎛️ Spin Your DOM Elements with a Virtual Trackball

Turn pointer drags into smooth 3D rotations.

Trackball.js is a small JavaScript library built on top of Quaternion.js that lets you add a virtual trackball to any DOM element. It captures pointer input, computes a quaternion representing the rotation, and calls your callback so you can apply the transform. This frees you from writing your own rotation math while giving you full control over styling.

✨ Highlights

  • Virtual trackball: translates pointer drags into natural 3D rotation.
  • Quaternion math: built on Quaternion.js for stable, gimbal‑free rotations.
  • CSS transform output: provides toCSSTransform() for direct application.
  • Active area: restrict interaction to a sub‑rectangle of the scene.
  • Inertia: optional damping simulates continued motion after release.
  • Axis locking: limitAxis can lock rotation to X or Y.

💡 Why it matters

Unlike libraries that bundle styling, Trackball.js only computes the rotation quaternion, letting you design the UI exactly as you wish. This separation makes it easy to integrate into existing projects without overriding your CSS.

Because it works with any DOM element and outputs a standard quaternion, it fits well for 3D product viewers, interactive diagrams, or any site that needs intuitive rotation controls.


#JavaScript #3D #Trackball #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryJavaScript
twbs/bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.

175.1k
Dec 1, 2026
RepositoryJavaScript
juliangarnier/anime

JavaScript animation engine

75.3k
Dec 1, 2026
RepositoryJavaScript
mrdoob/three.js

JavaScript 3D Library.

120.1k
Dec 2, 2026
RepositoryJavaScript
mrdoob/three.js

JavaScript 3D Library.

120.1k
Dec 2, 2026
RepositoryC++
electron/electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

124.3k
Dec 2, 2026
Repository
getify/You-Dont-Know-JS

A book series (2 published editions) on the JS language.

184.8k
Oct 31, 2026
RepositoryJavaScript
Chalarangelo/30-seconds-of-code

Coding articles to level up your development skills

129.6k
Nov 17, 2026
RepositoryJavaScript
microsoft/Web-Dev-For-Beginners

24 Lessons, 12 Weeks, Get Started as a Web Developer

97.2k
Dec 1, 2026
RepositoryJavaScript
react/react

The library for web and native user interfaces.

253.0k
Nov 30, 2026