安卓系统可以,未测试ios

plus.orientation.getCurrentOrientation((res) => {
	const {alpha,gamma} = res
	this.direction = ((360 - ((alpha - gamma) % 360) + 360) % 360).toFixed(2)
})

plus.orientation.getCurrentOrientation使用官方网站:

https://www.html5plus.org/doc/zh_cn/orientation.html

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐