移动设备 - 测试1秒能摇多少次
来源:互联网 发布:消防工程师网络培训班 编辑:程序博客网 时间:2024/05/20 09:21
<!doctype html><html><head><meta charset="utf-8"><title>移动设备 - 测试1秒能摇多少次</title><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/><meta name="viewport" content="width=device-width,initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"><meta http-equiv="pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0"><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="format-detection" content="telephone=no"><meta name="apple-mobile-web-app-title" content=""></head><body><div id="click" style="width:80px; height:80px; line-height:80px; text-align:center; color:#fff; border-radius:50%; background-color:#333; cursor:pointer;">开始摇</div><script type="text/javascript"> var SHAKE_THRESHOLD = 1000; var last_update = 0; var x = y = z = last_x = last_y = last_z = 0; var SHAKE_NUM = 0; function init() { if (window.DeviceMotionEvent) { window.addEventListener('devicemotion', deviceMotionHandler, false); } else { alert('not support mobile event'); } } function deviceMotionHandler(eventData) { var acceleration = eventData.accelerationIncludingGravity;//eventData.acceleration; var curTime = new Date().getTime(); if ((curTime - last_update) > 100) { var diffTime = curTime - last_update; last_update = curTime; x = acceleration.x; y = acceleration.y; z = acceleration.z; var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000; if (speed > SHAKE_THRESHOLD) { SHAKE_NUM++;shakePhone(); } } last_x = x; last_y = y; last_z = z; }document.getElementById('click').onclick = function (){init();SHAKE_NUM = 0;setTimeout(function(){alert(SHAKE_NUM);},1000);}</script></body></html>
0 0
- 移动设备 - 测试1秒能摇多少次
- 移动设备UserAgent测试
- 移动设备的FM测试
- 移动设备测试自动化工具
- 移动设备App测试总结
- 淘宝移动设备测试框架TMTS
- 10款优秀的移动设备测试工具(英文)
- 在mac上用node搭建移动设备测试服务器
- 用Flex开发移动应用(3)---- 在桌面和移动设备上测试
- 八-1 使用设备模式模拟移动设备
- 去除android2.1移动设备3G图标
- HTML5 移动设备页面布局 - 1
- 移动设备分辨率-媒体查询1
- Appium移动自动化测试1
- 测试设备
- 统计1~100出现多少次9
- UE4 移动设备摄像机移动
- WebStorm设置服务器-局域网内其他设备访问(移动端手机访问测试等)
- 计算机网络重点知识
- leetcode 70. Climbing Stairs
- 【Redis】配置文件参数说明详解
- spark-shell无法退格或者删除
- 实现samba可写不可删除
- 移动设备 - 测试1秒能摇多少次
- Centos 7 下命令整理
- Java阻塞队列BlockingQueue的使用
- Linux命令学习:shutdown
- MongoDB 启动文件设置
- Python中Super的使用
- OpenCV仪表数据识别(三):数据按行分割
- 使用超图SuperMap制作气象类专题图全攻略(一)
- [摘录]How browsers work之页面渲染流程