我正在玩跳跃运动的JS SDK。无论我在互联网上看到哪个例子,它都运行得很好,即使浏览器窗口在后台=示例在每个帧上得到更新。但是,我不知道该怎么做才能真正实现同样的目标,我的示例总是在浏览器窗口失去焦点时停止。让我们举个很小的例子:
<body>
<p style="margin-left: 100px" id="info"></p>
<script>
var info = document.getElementById('info');
var controller = new Leap.Controller({
host: '127.0.0.1',
port: 6437,
enableGestures: true,
frameEventName: 'animationFrame',
useAllPlugins: true
});
controller.connect();
controller.setBackground(true);
controller.on('frame', onFrame);
function onFrame(frame) {
info.innerHTML = frame.id;
}
</script>
</body>Controller.setBackground()说:通知Leap移动WebSocket服务器,您的应用程序总是希望在后台接收跟踪数据的帧,而不是主动使用它。请注意,当用户与其他应用程序交互时,设置此选项true可能会导致对应用程序的意外输入。大多数应用程序不应该在后台接收帧。
对我来说有点不管用,我做错什么了?非常感谢!
发布于 2014-03-19 20:59:53
https://stackoverflow.com/questions/22493052
复制相似问题