# 3d-attraction

> A library to rotate DOM elements in 3D space based on mouse movement

Latest version **1.0.0** (published 2018-11-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install 3d-attraction
pnpm add 3d-attraction
yarn add 3d-attraction
bun add 3d-attraction
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-11-26 |
| First published | 2018-11-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Adam Chambers |
| Maintainers | chambaz |

## Links

- npm: https://www.npmjs.com/package/3d-attraction
- Repository: https://github.com/chambaz/3d-attraction
- Homepage: https://github.com/chambaz/3d-attraction#readme
- Issues: https://github.com/chambaz/3d-attraction/issues
- npm.io page: https://npm.io/package/3d-attraction

## Recent versions

- 1.0.0 (latest) — 2018-11-26

## README

# 3D Attraction

A library to rotate DOM elements in 3D space based on mouse movement. [Demo on CodePen](https://codepen.io/chambaz/pen/EygZMw).

**Getting Started**

Install with NPM

```bash
$ npm i --save 3d-attraction
```

Require the module

```javascript
const attract = require('3d-attraction')
```

Add data attributes to the container and target. Container is the area the mouse movement is relative too, and target is the element that will be transformed.

```html
<div class="my-container" data-3d-attract-container>
  <div class="my-target-parent">
    <div class="my-target" data-3d-attract></div>
  </div>
</div>
```

Add CSS and tweak values to your desire

```css
/* perspective should be added to target parent not necessarily the container */
.my-target-parent {
  perspective: 400px;
}

.my-target {
  transform-style: preserve-3d;
  transition: 1.5s ease-out;
}
```

---
_Source: https://npm.io/package/3d-attraction · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
