0.3.3 • Published 1 year ago

request-animation-runner v0.3.3

Weekly downloads
8
License
MIT
Repository
github
Last release
1 year ago

request-animation-runner

npm npm bundle size

Class for run loop animation with RAF

Install

npm

npm install request-animation-runner

yarn

yarn add request-animation-runner

Usage

import RequestAnimation from 'request-animation-runner';

const requestAnimation = new RequestAnimation();

requestAnimation.activate();
requestAnimation.run(() => {
  // some logic
});

API

requestAnimation.deactivate()

Disable call requests.

requestAnimation.deactivate();
requestAnimation.run(() => {
  // some logic
}); // no effect

requestAnimation.activate();
requestAnimation.run(() => {
  // some logic
}); // handler is called

requestAnimation.activate()

Enable call requests.

requestAnimation.deactivate();
requestAnimation.run(() => {
  // some logic
}); // no effect

requestAnimation.activate();
requestAnimation.run(() => {
  // some logic
}); // handler is called

requestAnimation.run

Resolve the animation loop calculates time elapsed since the last loop and only draws if your specified fps interval is achieved.

  • @param {function} animationFunc - Function for animation
  • @param {string} fps - Frames per Second

  • @returns {undefined}

requestAnimation.run(() => {
  // some logic
});

requestAnimation.request

Request single call.

  • @param {function} animationFunc - Function for animation

  • @returns {undefined}

requestAnimation.request(() => {
  // some logic
});

requestAnimation.cancelRequest

Cancel current request.

  • @returns {undefined}
requestAnimation.cancelRequest();

Run tests

npm test

Maintainer

Krivega Dmitriy

Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page. You can also take a look at the contributing guide.

📝 License

Copyright © 2020 Krivega Dmitriy. This project is MIT licensed.

0.3.3

1 year ago

0.3.2

2 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.3.1

3 years ago

0.1.0

3 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago