gpt4 book ai didi

javascript - 如何使用 Web Vibration API 控制振动的幅度/强度?

转载 作者:行者123 更新时间:2023-12-05 05:35:21 28 4
gpt4 key购买 nike

我们的网络应用程序使用 the Vibrate API对于微妙的按钮按下效果:

window.navigator.vibrate(5);

但在我的新手机上,感觉不那么微妙,更像是我的手机正试图从我手中跳出来。问题是 window.navigator.vibrate API 不允许我设置振动的幅度/强度;它只允许我设置持续时间。

使用 Android 的 VibrationEffectyou can set the "amplitude" .使用 iOS 的核心触觉,you can set "intensity" and "sharpness" .

如何使用 Web Vibrate API 设置振动的振幅/强度/锐度/强度?

最佳答案

看看the spec除了振动模式之外,似乎没有任何东西可以让您控制任何东西。

来自规范 W3C

typedef (unsigned long or sequence<unsigned long>) VibratePattern;

partial interface Navigator {
boolean vibrate (VibratePattern pattern);
};

The vibrate() method steps are to run the processing vibration patterns algorithm. A vibration pattern is represented by a VibratePattern object.

关于javascript - 如何使用 Web Vibration API 控制振动的幅度/强度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73540062/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com