1.0.8 • Published 4 years ago

ngx-touch-trail v1.0.8

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

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 version 10.0.9.

Demo

Example gif

Demo here.

Installation

npm i ngx-touch-trail --save

@angular/animations package is a required dependency for the default toast

npm install @angular/animations --save

Setup

Module:

import { NgxTouchTrailModule } from 'ngx-touch-trail'
....
imports: [
  .....
  NgxTouchTrailModule
],

Component

It works as a directive so

<div touchTrail (touchTrailEnded)="consoleLog($event)">
  <span>touch and move</span>
</div>

or customize it:

<div
  touchTrail="{color:'#f00',eventType:'mouse'}"
  [disableTrail]="isTrailActive"
  (touchTrailEnded)="consoleLog($event)">
  <span>touch and move</span>
</div>

Parameters

NameDescriptionDefault
(touchTrailEnded)Called when trail finish (usually on touchend)
classNameSet dot class'touch-trail-dot'
eventTypeSet trigger event (touch/mouse)'touch'
destroyDelayms before dot get destroyed400
interpolationStepPixels between interpolated dots100
maxInterpolatedDotsMax number of interpolated dots90
colorTrail color'#3da4ab'
clearOnInitAt begining of new trail destroy previous one (usually on touchstrat)true
freezeOnEndFreeze dots on trail finish (usually on touchend)false
animationMetaAnimation method(index: number, options: any) => AnimationMetadata[]

animationMeta

This method controls dots animation it get

NameDescription
indexIndex in dots array
optionsFull options object
1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago