Catalog npm
Back to packageRELEASE DETAILS

1.0.3

npm

3dtilt

A lightweight React component for creating a 3D tilt effect with customizable options.

3d-tiltanimationcomponenteffectreacttilttypescript
Published10 Aug 2024
Direct dependencies13
Transitive dependenciesNot calculated

README

Current package documentation

3DTilt

3DTilt is a React component that adds a 3D tilt effect to any element. It offers various customization options to fine-tune the effect, including tilt angles, perspective, transition speed, and optional glare effects.

Installation

You can install the 3DTilt package using npm or Yarn.

npm

npm install 3DTilt

yarn

yarn add 3DTilt

Usage

Basic Example

import React from 'react';
import ThreeDTilt from '3dtilt';

const BasicExample = () => {
  return (
    <ThreeDTilt>
      <div style={{ padding: '50px', background: 'lightblue', borderRadius: '10px' }}>
        <h1>Basic 3D Tilt</h1>
      </div>
    </ThreeDTilt>
  );
};

export default BasicExample;

Options

Option NameTypeDefault ValueDescription
maxTiltnumber20The maximum tilt angle in degrees.
perspectivenumber300The perspective distance in pixels.
easingstring'cubic-bezier(.03,.98,.52,.99)'The CSS easing function for transitions.
scalenumber1The scaling factor applied to the element when tilted.
speednumber400The speed of the transition in milliseconds.
transitionbooleantrueDetermines whether transitions should be used.
disableAxis`'x''y'null`
resetbooleantrueResets the tilt effect when the mouse leaves the element.
glarebooleanfalseAdds a glare effect to the element.
maxGlarenumber1The maximum opacity of the glare effect.
glarePrerenderbooleanfalseDetermines whether the glare effect is prerendered.

Options and Separate Examples

1. maxTilt (number)

The maximum tilt angle in degrees.

Default: 20

import React from 'react';
import ThreeDTilt from '3dtilt';

const MaxTiltExample = () => {
  return (
    <ThreeDTilt options={{ maxTilt: 40 }}>
      <div style={{ padding: '50px', background: 'lightgreen', borderRadius: '10px' }}>
        <h1>Max Tilt: 40°</h1>
      </div>
    </ThreeDTilt>
  );
};

export default MaxTiltExample;

2. perspective (number)

The distance from the viewer to the element, which affects the depth of the 3D effect.

Default: 300

import React from 'react';
import ThreeDTilt from '3dtilt';

const PerspectiveExample = () => {
  return (
    <ThreeDTilt options={{ perspective: 1000 }}>
      <div style={{ padding: '50px', background: 'lightcoral', borderRadius: '10px' }}>
        <h1>Perspective: 1000px</h1>
      </div>
    </ThreeDTilt>
  );
};

export default PerspectiveExample;

3. easing (string)

The CSS easing function for the transition effect.

Default: 'cubic-bezier(.03,.98,.52,.99)'

import React from 'react';
import ThreeDTilt from '3dtilt';

const EasingExample = () => {
  return (
    <ThreeDTilt options={{ easing: 'linear' }}>
      <div style={{ padding: '50px', background: 'lightsalmon', borderRadius: '10px' }}>
        <h1>Easing: Linear</h1>
      </div>
    </ThreeDTilt>
  );
};

export default EasingExample;

4. scale (number)

The scaling factor applied to the element when it is tilted.

Default: 1

import React from 'react';
import ThreeDTilt from '3dtilt';

const ScaleExample = () => {
  return (
    <ThreeDTilt options={{ scale: 1.2 }}>
      <div style={{ padding: '50px', background: 'lightyellow', borderRadius: '10px' }}>
        <h1>Scale: 1.2</h1>
      </div>
    </ThreeDTilt>
  );
};

export default ScaleExample;

5. speed (number)

The speed of the transition in milliseconds.

Default: 400

import React from 'react';
import ThreeDTilt from '3dtilt';

const SpeedExample = () => {
  return (
    <ThreeDTilt options={{ speed: 1000 }}>
      <div style={{ padding: '50px', background: 'lightpink', borderRadius: '10px' }}>
        <h1>Speed: 1000ms</h1>
      </div>
    </ThreeDTilt>
  );
};

export default SpeedExample;

6. transition (boolean)

Determines whether transitions should be used.

Default: true

import React from 'react';
import ThreeDTilt from '3dtilt';

const TransitionExample = () => {
  return (
    <ThreeDTilt options={{ transition: false }}>
      <div style={{ padding: '50px', background: 'lightgray', borderRadius: '10px' }}>
        <h1>Transition: Disabled</h1>
      </div>
    </ThreeDTilt>
  );
};

export default TransitionExample;

7. disableAxis (string or null)

Disables tilt on the 'x' or 'y' axis.

Default: null

import React from 'react';
import ThreeDTilt from '3dtilt';

const DisableAxisExample = () => {
  return (
    <ThreeDTilt options={{ disableAxis: 'x' }}>
      <div style={{ padding: '50px', background: 'lightcyan', borderRadius: '10px' }}>
        <h1>Disable Axis: X</h1>
      </div>
    </ThreeDTilt>
  );
};

export default DisableAxisExample;

8. reset (boolean)

Resets the tilt effect when the mouse leaves the element.

Default: true

import React from 'react';
import ThreeDTilt from '3dtilt';

const ResetExample = () => {
  return (
    <ThreeDTilt options={{ reset: false }}>
      <div style={{ padding: '50px', background: 'lightgoldenrodyellow', borderRadius: '10px' }}>
        <h1>Reset: Disabled</h1>
      </div>
    </ThreeDTilt>
  );
};

export default ResetExample;

9. glare (boolean)

Adds a glare effect to the element.

Default: false

import React from 'react';
import ThreeDTilt from '3dtilt';

const GlareExample = () => {
  return (
    <ThreeDTilt options={{ glare: true }}>
      <div style={{ padding: '50px', background: 'lightskyblue', borderRadius: '10px' }}>
        <h1>Glare: Enabled</h1>
      </div>
    </ThreeDTilt>
  );
};

export default GlareExample;

10. maxGlare (number)

The maximum opacity of the glare effect.

Default: 1

import React from 'react';
import ThreeDTilt from '3dtilt';

const MaxGlareExample = () => {
  return (
    <ThreeDTilt options={{ glare: true, maxGlare: 0.5 }}>
      <div style={{ padding: '50px', background: 'lightsteelblue', borderRadius: '10px' }}>
        <h1>Max Glare: 0.5</h1>
      </div>
    </ThreeDTilt>
  );
};

export default MaxGlareExample;

11. glarePrerender (boolean)

Determines whether the glare effect is prerendered.

Default: false

import React from 'react';
import ThreeDTilt from '3dtilt';

const GlarePrerenderExample = () => {
  return (
    <ThreeDTilt options={{ glare: true, glarePrerender: true }}>
      <div style={{ padding: '50px', background: 'lightseagreen', borderRadius: '10px' }}>
        <h1>Glare Prerender: Enabled</h1>
      </div>
    </ThreeDTilt>
  );
};

export default GlarePrerenderExample;

License

This project is open-source and available under the MIT License.

Downloads & popularity

1downloads
7-day window · source-reported counts20 Oct 2026
10.50
2026-10-20: 1 · observed 2026-10-20T22:37:13.5225484Z
20 Oct20 Oct

npm · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-2012026-10-20T22:37:13.5225484Z

Declared dependencies 13

Native requirements
13 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.2.0runtime
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.0runtime
prop-types
Environment
{
  "local_name": "prop-types",
  "alias": false,
  "peer_metadata": null
}
^15.8.1runtime
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.2.14runtime
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.2.6runtime
@types/prop-types
Environment
{
  "local_name": "@types/prop-types",
  "alias": false,
  "peer_metadata": null
}
^15.7.5runtime
tslib
Environment
{
  "local_name": "tslib",
  "alias": false,
  "peer_metadata": null
}
^2.6.0development
rollup
Environment
{
  "local_name": "rollup",
  "alias": false,
  "peer_metadata": null
}
^2.0.0development
@rollup/plugin-babel
Environment
{
  "local_name": "@rollup/plugin-babel",
  "alias": false,
  "peer_metadata": null
}
^6.0.3development
rollup-plugin-terser
Environment
{
  "local_name": "rollup-plugin-terser",
  "alias": false,
  "peer_metadata": null
}
^7.0.2development
@rollup/plugin-commonjs
Environment
{
  "local_name": "@rollup/plugin-commonjs",
  "alias": false,
  "peer_metadata": null
}
^25.0.2development
rollup-plugin-typescript2
Environment
{
  "local_name": "rollup-plugin-typescript2",
  "alias": false,
  "peer_metadata": null
}
^0.35.0development
@rollup/plugin-node-resolve
Environment
{
  "local_name": "@rollup/plugin-node-resolve",
  "alias": false,
  "peer_metadata": null
}
^15.1.0development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "6122079a601955322091a5d1aa70e17e8fd981bf",
  "tarball": "https://registry.npmjs.org/3dtilt/-/3dtilt-1.0.3.tgz",
  "fileCount": 6,
  "integrity": "sha512-XaQa+v1ycetbO81QE6WkAMxqKm2TsD+0In+DYIlwSXzgsBXsRAHBG8gec5LQZyEzLCuAeHHNYLSFN5Cz8ym0zA==",
  "signatures": [
    {
      "sig": "MEUCIDhWkr4GWxmoVZ8gL+w6xazy4rq7wPlz07t8RqOyLFtYAiEAxDykijj+IJZ/1a/KUSzXPUD7paDOLV0UXeNbju+iNZM=",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 15026
}

Repository

PENDING
sivamani-18/3dtilt

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:41 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:d71d1a997186d532bbf77c6b79f44f67950a5bf1a024f2e00a72411bc550767e

Other collected versions

1.0.410 Aug1.0.010 Aug1.0.210 Aug1.0.110 AugView all collected versions →