# ngx-touch-trail

> ## Features - Create a trail that follows finger on touch move (or mouse on mousemove) - You can set your own animation to trail elements - the trail process works on runOutsideAngular, avoiding change detection calls. - On finish launch a event touchTrai

Latest version **1.0.8** (published 2020-09-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install ngx-touch-trail
pnpm add ngx-touch-trail
yarn add ngx-touch-trail
bun add ngx-touch-trail
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2020-09-10 |
| First published | 2020-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 209.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jose Baro |
| Maintainers | jbarog |
| Keywords | angular, javascript, typescript, directive, touchmove, mousemove |

## Links

- npm: https://www.npmjs.com/package/ngx-touch-trail
- Repository: https://github.com/jbarog/ngx-touch-trail
- Issues: https://github.com/jbarog/ngx-touch-trail/issues
- npm.io page: https://npm.io/package/ngx-touch-trail

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.0.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2020-09-10
- 1.0.7 — 2020-09-10
- 1.0.6 — 2020-09-10
- 1.0.5 — 2020-09-10
- 1.0.4 — 2020-09-10
- 1.0.3 — 2020-09-03
- 1.0.2 — 2020-09-03
- 1.0.1 — 2020-09-03

## README

# NgxTouchTrail

## Features
- Create a trail that follows finger on touch move (or mouse on mousemove)
- You can set your own animation to trail elements
- the trail process works on runOutsideAngular, avoiding change detection calls.
- On finish launch a event touchTrailEnded with information about initial and final position

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.9.

## Demo

![Example gif](https://raw.githubusercontent.com/jbarog/ngx-touch-trail/master/src/assets/demo.gif?raw=true)

[Demo here](https://stackblitz.com/edit/ngx-touch-trail).

## Installation

```bash
npm i ngx-touch-trail --save
```
`@angular/animations` package is a required dependency for the default toast

```bash
npm install @angular/animations --save
```

## Setup
### Module:
```typescript
import { NgxTouchTrailModule } from 'ngx-touch-trail'
....
imports: [
  .....
  NgxTouchTrailModule
],
```
### Component
It works as a directive so
```html
<div touchTrail (touchTrailEnded)="consoleLog($event)">
  <span>touch and move</span>
</div>
```
or customize it:
```html
<div
  touchTrail="{color:'#f00',eventType:'mouse'}"
  [disableTrail]="isTrailActive"
  (touchTrailEnded)="consoleLog($event)">
  <span>touch and move</span>
</div>
```
## Parameters

Name  | Description | Default |
------------- | ------------- | -------------
(touchTrailEnded)  | Called when trail finish (usually on touchend)|
className  | Set dot class   | 'touch-trail-dot'
eventType  | Set trigger event (touch/mouse) | 'touch'
destroyDelay  | ms before dot get destroyed | 400
interpolationStep  | Pixels between interpolated dots | 100
maxInterpolatedDots  | Max number of interpolated dots | 90
color  | Trail color | '#3da4ab'
clearOnInit  | At begining of new trail destroy previous one (usually on touchstrat) | true
freezeOnEnd  | Freeze dots on trail finish (usually on touchend) | false
animationMeta  | Animation method  | (index: number, options: any) => AnimationMetadata[]

## animationMeta

This method controls dots animation it get

Name  | Description |
------------- | -------------
index  | Index in dots array
options  | Full options object

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