Re: [w3c/gamepad] [Extensions] make pulse() more like navigator.vibrate (#66)

I think this is insufficient for the types of vibration effects that are common on gamepads. For instance, most modern gamepads support vibrating at varying intensity levels rather than simple on/off durations as used by `navigator.vibrate`.

I've proposed an alternate extension for vibration effects, please take a look:

https://github.com/w3c/gamepad/issues/19#issuecomment-321424335

It's used like this:

    let pads = navigator.getGamepads();
    pads[0].vibrationActuator.playEffect("dual-rumble", {
        startDelay: 0,
        duration: 1000,
        weakMagnitude: 0.5,
        strongMagnitude: 0.5
    });

`playEffect` returns a Promise that resolves once the effect playback is complete. You can take advantage of this to simulate the on/off durations used by `navigator.vibrate`:

    let startEffect = { duration: 100, weakMagnitude: 1.0 };
    let continueEffect = { startDelay: 500, duration: 100, weakMagnitude: 1.0 };
    pads[0].vibrationActuator.playEffect("dual-rumble", startEffect).then(() => {
        pads[0].vibrationActuator.playEffect("dual-rumble", continueEffect)
    });

-- 
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/issues/66#issuecomment-347651045

Received on Tuesday, 28 November 2017 20:20:20 UTC