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 🙏

© 2025 – Pkg Stats / Ryan Hefner

tilt-3d

v1.0.4

Published

A smooth 3D tilt JavaScript + TypeScript library

Readme

tilt-3d

A smooth 3D tilt JavaScript + TypeScript library

Demo

Installation

To install the package, use npm:

pnpm add tilt-3d

yarn install tilt-3d

npm install tilt-3d

Usage

import { Tilt3d } from 'tilt-3d';

const elements = document.querySelectorAll(".tilt-3d");

Tilt3d.init(elements)

Nuxt 3 (in file plugins/tilt-3d.ts)

import { Tilt3d, type Settings } from 'tilt-3d'
import type { DirectiveBinding } from 'vue'

export default defineNuxtPlugin((nuxtApp) => {
    const map: Map<HTMLElement, Tilt3d> = new Map()

    nuxtApp.vueApp.directive<HTMLElement, Partial<Settings>>('tilt-3d', {
        mounted(el: HTMLElement, binding: DirectiveBinding<Partial<Settings>>) {
            if (map.has(el)) return

            const tilt3d = new Tilt3d(el, binding.value || {})

            map.set(el, tilt3d)
        },
        unmounted(el: HTMLElement) {
            const tilt3d = map.get(el)

            tilt3d?.destroy()

            map.delete(el)
        },
        getSSRProps() {
            return {}
        },
    })
})

// Use just as a directive: <div v-tilt-3d>Content</div> or  <div v-tilt-3d={settings}>Content</div>

React (in file hooks/useTilt3d.ts)

import { useEffect, useRef } from 'react';
import { Tilt3d, type Settings } from 'tilt-3d';

export const useTilt3d = (settings: Partial<Settings> = {}) => {
    const elementRef = useRef<HTMLElement | null>(null);
    const tilt3dRef = useRef<Tilt3d | null>(null);

    useEffect(() => {
        if (elementRef.current) {
            tilt3dRef.current = new Tilt3d(elementRef.current, settings);
        }

        return () => {
            if (tilt3dRef.current) {
                tilt3dRef.current.destroy();
            }
        };
    }, [settings]);

    return elementRef;
};

// Use just as a hook:
// const ref = useTilt3d({ /* Settings */ });
// <div ref={ref} style={{ width: '200px', height: '200px', backgroundColor: 'lightgray' }}>
//     Tilt me!
// </div>

Options

{
    reverse:                false,  // reverse the tilt direction
    max:                    15,     // max tilt rotation (degrees)
    startX:                 0,      // the starting tilt on the X axis, in degrees.
    startY:                 0,      // the starting tilt on the Y axis, in degrees.
    perspective:            1000,   // Transform perspective, the lower the more extreme the tilt gets.
    scale:                  1,      // 2 = 200%, 1.5 = 150%, etc..
    speed:                  300,    // Speed of the enter/exit transition
    transition:             true,   // Set a transition on enter/exit.
    axis:                   null,   // What axis should be enabled. Can be "x" or "y".
    reset:                  true,   // If the tilt effect has to be reset on exit.
    "reset-to-start":       true,   // Whether the exit reset will go to [0,0] (default) or [startX, startY]
    easing:                 "cubic-bezier(.03,.98,.52,.99)",    // Easing on enter/exit.
    glare:                  false,  // if it should have a "glare" effect
    "max-glare":            1,      // the maximum "glare" opacity (1 = 100%, 0.5 = 50%)
    "glare-prerender":      false,  // false = VanillaTilt creates the glare elements for you, otherwise
                                    // you need to add .js-tilt-glare>.js-tilt-glare-inner by yourself
    "mouse-event-element":  null,   // css-selector or link to an HTML-element that will be listening to mouse events
    "full-page-listening":  false,  // If true, parallax effect will listen to mouse move events on the whole document, not only the selected element
    gyroscope:              true,   // Boolean to enable/disable device orientation detection,
    gyroscopeMinAngleX:     -45,    // This is the bottom limit of the device angle on X axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the left border of the element;
    gyroscopeMaxAngleX:     45,     // This is the top limit of the device angle on X axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the right border of the element;
    gyroscopeMinAngleY:     -45,    // This is the bottom limit of the device angle on Y axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the top border of the element;
    gyroscopeMaxAngleY:     45,     // This is the top limit of the device angle on Y axis, meaning that a device rotated at this angle would tilt the element as if the mouse was on the bottom border of the element;
    gyroscopeSamples:       10      // How many gyroscope moves to decide the starting position.
}

tsup

Bundle your TypeScript library with no config, powered by esbuild.

https://tsup.egoist.dev/

How to use this

  1. install dependencies
# pnpm
$ pnpm install

# yarn
$ yarn install

# npm
$ npm install
  1. Add your code to src
  2. Add export statement to src/index.ts
  3. Test build command to build src. Once the command works properly, you will see dist folder.
# pnpm
$ pnpm run build

# yarn
$ yarn run build

# npm
$ npm run build
  1. Publish your package
$ npm publish

test package

https://www.npmjs.com/package/tilt-3d