我希望能够使用headtrackr.js滚动显示头部运动的页面
https://github.com/auduno/headtrackr
我已将代码实现到基本的html页面上。
<html>
<head>
<title>Test</title>
<script src="headtrackr.js"></script>
</head>
<body>
<canvas id="inputCanvas" width="320" height="240" style="display:none"></canvas>
<video id="inputVideo" autoplay loop></video>
<script type="text/javascript">
var videoInput = document.getElementById('inputVideo');
var canvasInput = document.getElementById('inputCanvas');
var htracker = new headtrackr.Tracker();
htracker.init(videoInput, canvasInput);
htracker.start();
</script>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. </p>
</body>
</html>
以上已启用SSL-出现视频。面部被检测到。但是文档不会滚动。
我还需要其他东西吗?像听众一样阅读headtrackr的读物?我在github或http://www.digitoffee.com/video/scroll-a-document-by-just-moving-your-head/428/的文档中找不到此文件
最佳答案
也许尝试添加此事件侦听器以更改您要执行的操作?
document.addEventListener('headtrackingEvent', function(e) {
window.scrollTo( e.x, e.y );
}