raf-iterator

1.0.0 • Public • Published

raf-iterator

requestAnimationFrame as an async iterator

Install - Usage - License: Apache-2.0

npm travis standard

Install

npm install raf-iterator

Usage

const rafIterator = require('raf-iterator')
 
for await (const tick of rafIterator()) {
  draw(tick)
  if (ended) {
    break
  }
}

API

rafIterator()

Returns an Async Iterator that can be used in a for await loop. Each iteration yields an incrementing tick integer. Iterations occur at the speed of requestAnimationFrame ticks, about 60fps.

breaking from the loop prevents further animation frame requests.

License

Apache-2.0

Package Sidebar

Install

npm i raf-iterator

Weekly Downloads

1

Version

1.0.0

License

Apache-2.0

Unpacked Size

4.62 kB

Total Files

8

Last publish

Collaborators

  • goto-bus-stop