0.3.3 • Published 1 month ago

@candlefinance/haptics v0.3.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 month ago

Supports playing haptics on iOS with default UIImpactFeedbackGenerator and CoreHaptics for patterns and ahap files. Vibrates on Android.

Installation

yarn add @candlefinance/haptics
npm i @candlefinance/haptics

Basic Usage

There are three functions:

import { haptic, hapticWithPattern } from '@candlefinance/haptics';

// light, medium, heavy, soft, rigid, warning, error, success, selectionChanged
haptic('medium');

// pattern
hapticWithPattern(['.', '.', '.', 'o', 'O', '-', 'O', 'o', '.', '.', '.', '.']);

// play ahap file (iOS only)
play('fileName');

The pattern format:

- 'o' - medium impact
- 'O' - heavy impact
- '.' - light impact
- ':' - soft impact
- '-' - wait of 0.1 second
- '=' - wait of 1 second

For playing ahap files to the root of your project add a folder called haptics and add your ahap files there. Use (Haptrix)https://www.haptrix.com/ or equivalent to generate ahap files.

Contributing

Join our Discord and ask questions in the #oss channel.

License

MIT

0.3.3

1 month ago

0.3.2

6 months ago

0.3.1

6 months ago

0.3.0

7 months ago

0.2.3

8 months ago

0.2.2

8 months ago