如何衡量 Web 上的压力?
How to measure the force of pressure on the Web?
最近Apple 推出了一款新的触控板,它支持“Force Touch”功能。它类似于Wacom绘画数位板,因为通过专用软件,您可以测量按压的力(重量)。
那么,是否可以使用像 javascript 这样的网络技术来获取这些值?浏览器是否提供任何API和有关压力的信息?
P.S。我发现这个问题与我的问题有关,但它与网络无关:Android, IOS force pressing on the screen
您正在查找 PointerEvent. This isn't widely supported across browsers yet, as it's not a final spec, but as of this writing IE11 has some support 的 pressure
属性。
对于 iOS(iPhone 6 秒)和 Mac(带有 Force Touch 的新 MabBook Pro),您可以使用 Pressure.js。它是一个 JavaScript 库,可让您在 Web 上简单地使用强制触摸。这是基本用法的示例:
Pressure.set('#element', {
change: function(force, event){
// this is called every time there is a change in pressure
},
unsupported: function(){
// this is called if device or browser does not support Force or 3D touch
}
});
最近Apple 推出了一款新的触控板,它支持“Force Touch”功能。它类似于Wacom绘画数位板,因为通过专用软件,您可以测量按压的力(重量)。
那么,是否可以使用像 javascript 这样的网络技术来获取这些值?浏览器是否提供任何API和有关压力的信息?
P.S。我发现这个问题与我的问题有关,但它与网络无关:Android, IOS force pressing on the screen
您正在查找 PointerEvent. This isn't widely supported across browsers yet, as it's not a final spec, but as of this writing IE11 has some support 的 pressure
属性。
对于 iOS(iPhone 6 秒)和 Mac(带有 Force Touch 的新 MabBook Pro),您可以使用 Pressure.js。它是一个 JavaScript 库,可让您在 Web 上简单地使用强制触摸。这是基本用法的示例:
Pressure.set('#element', {
change: function(force, event){
// this is called every time there is a change in pressure
},
unsupported: function(){
// this is called if device or browser does not support Force or 3D touch
}
});