Re: [w3c/gamepad] Added a supplemental "Extensions" spec (#32)

I was unaware that touch had haptic feedback at all, so thanks for pointing out the function! The base vibration function this one is based on takes an array of durations that they refer to as the vibration pattern. It's a series of on-off timespans. So `[500, 100, 1000, 100, 500]` means:

- Vibrate for 500ms
- Turn off for 100ms
- Vibrate for 1s
- Turn off for 100ms
- Vibrate for 500ms

That seems similar-ish to the Touch haptics, though I don't really understand the timing of that API. Looks like you provide a bunch of amplitudes and it just ticks through them at a constant rate? In any case, for our haptics needs we'd probably want duration and intensity pairs, which might look a little ugly. Probably look something like:

`gamepad.haptics[0].vibrate([1.0, 0.5, 0, 1.0], [300, 500, 1000, 200]);`

Which would be:

- Full intensity for 300ms
- Half intensity for 500ms
- No vibration for 1s
- Full intensity for 200ms

:P 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/pull/32#issuecomment-246867656

Received on Wednesday, 14 September 2016 00:19:28 UTC