Description
Copy pasted from @domenic's original issue rwaldron/sensors#5
For games and other animation frame loop-based situations (off the top of my head, accelerometer-based scrolling comes to mind) you want one value per animation frame.
Chrome is actually doing work specifically to integrate our scheduling of input events and animation frames, see Blink Scheduler design doc.
Off the top of my head,
frequency: "animationframe"
might be good. The contract being that, if you pass that in to the constructor, then givenrequestAnimationFrame(function frame() { console.log(mySensor.value); requestAnimationFrame(frame); });you will get an updated value every frame.
I don't think
frequency: 60
is quite the same thing (but I could be wrong; will try to tag in some Blink engineers) since animation frames often vary away from 60 Hz and so you will quickly get out of sync.Posted to blink-dev: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/fLucJ2QH3fA unsure whether people will follow-up here or there.
Proposed resolution: Enabling developers to tie the frequency of sensor updates to animation framerate is a desirable feature. Further research is needed to see whether or not that is implementable.
Actions:
- research whether sensor update frequency can be tied to animation framerate.
- design the API so that developers can indicate the sensors update frequency must be framerate dependent.