2.0.1 • Published 2 years ago

@tap-payments/loader v2.0.1

Weekly downloads
189
License
ISC
Repository
-
Last release
2 years ago

Loader

Loader is a React component to animate tap logo. It is developed using Lottie and After Effects software. Component modifiable features are color, size, and duration/speed.

Color replacement

Modify the data.json file (the animation src) by using this website: Color editor Second URL. Animation json source file will be found in the gitHub repo. To implement a different color animation, refer to the Advanced implementation section.

Loader with closing animation

To get a closing animation, refer to the Adding a closing animation

Demo

Animation Files

Animation JSON files are available in the src file

Install the package

npm i --save @tap-payments/loader

Usage

  1. Import the loader component.
import {Loader} from '@tap-payments/loader'
  1. Wrap the loader component in a container.
<div>
  <Loader
  toggleAnimation={this.state.animating}
  duration={5}
  />
</div>
  1. Toggle it with a true/false variable to control the animation.
  2. Pass {true} to toggleAnimation to start the animation immediately.
  3. Pass {false} to toggleAnimation to stop the animation whenever it is possible.

Advanced

This component can be used to control any animation. To pass the animation source, import it in the parent component and pass it to the Loader component, the default duration is 10 sec, if the file has different duration, it should be passed also.

example:

Import the animation file:

import * as animationData from './data.json'

Pass it to the component, suppose that the new animation duration is 5 sec.

<Loader
toggleAnimation={this.state.animating}
duration={5.0}
animationData={animationData}
dataDuration={5.0}
/>

It is possible to change the duration of the animation by controlling duration prop, but dataDuration prop should be similar to the exporting settings in After Effects, in Tap Loader it is 10.0 sec.

Closing_Animation

Another animation can be integrated with the regular loading animation. This is done for the purpose of success, error and warning closing animation. To add the closing animation, pass the data of the closing animation as a json file in the props and it will be shown when the original animation is finished.

example:

Import the animation file:

import * as successAnimation from './success.json'

Pass it to the component.

  <Loader
  toggleAnimation={this.state.animating}
  duration={this.state.animating?3.5:2}
  animationData={animationData}
  secondData={successAnimation}
  secondDuration={10}
  />
duration= {this.state.animating?3.5:2} // the duration of the original motion, an 'if' condition is used to make the loader close faster.
animationData={animationData} // the animation src file of the loader
secondData= {successAnimation} // the animation src file of the closing animation
secondDuration = {10} // the duration of the closing animation, 10 = 100% of the AE file

To change the duration of the closing animation, change secondDuration and it will act as a percentage of the src file duration. Default duration is 10. If the duration of AE file animation is known, use secondDuration with secondDataDuration to get the exact preferred duration.

Main Options

NameTypeDefaultDescription
animationDataJSONtap loader JSON filethe src file
toggleAnimationboolfalseStart/Stop controller
durationfloat10.0The duration of full animation
dataDurationfloat10.0The duration of the source file (from After Effects)
completeIndicatorfunctionnullTo indicate every full loop
secondDatajsonnullThe src file of the second animation
secondDurationfloat10.0The duration of full animation (second animation)
secondDataDurationfloat10.0The duration of the source file of the second animation (from After Effects)

Author

1.2.0

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

2.0.0-beta

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.1

3 years ago

1.1.1-beta

3 years ago

1.1.0

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.15

4 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago