摘要
基于一系列新特性,HTML5催生出了如位置检测、重力感应等全新的用户和页面的交互方式,这些新型的交互功能迅速在用户中普及和流行。HTML5中的运动重力感应模块为移动端各种交互的实现提供了技术基础,文章以HTML5重力感应模块的主要技术DeviceMotionEvent为切入口,解析其技术原理及工作过程。以常见的手机交互“摇一摇”为例,利用Dom事件获取手机运动时的方向值、移动距离以及加速度等数据,加以处理并给予反馈,从而实现HTML5重力感应在手机交互中的应用。
A series of new features of HTML5 have given birth to new interaction modes between users and pages,such as position detection,gravity sensing,etc.These new interaction functions have rapidly become popular among users.The motion gravity sensing module in HTML5 provides a technical basis for the realization of various interactions on the mobile terminal.This paper takes DeviceMotionEvent,the main technology of the HTML5 gravity sensing module,as the entry point,to analyze its technical principle and working process.Taking the common mobile phone interaction“shake and shake”as an example,Dom event is used to obtain the direction value,moving distance,acceleration and other data when the mobile phone moves,process and give feedback,so as to realize the application of HTML5 gravity sensing in mobile phone interaction.
作者
陈桂霞
Chen Guixia(Yangzhou Branch of Jiangsu Union Technical Institute,Yangzhou 225000,China)
出处
《无线互联科技》
2023年第8期95-97,共3页
Wireless Internet Technology