Closed GrosSacASac closed 5 years ago
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)
});
closing to continue discussion github.com/w3c/gamepad/issues/19
It would be nice to have pulse be like navigator.vibrate or to have something similar
Thoughts ?