raf-iterator
requestAnimationFrame as an async iterator
Last updated 2 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install raf-iterator 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |