我需要使用 html5 和 javascript 重新创建一个 iPhone 游戏,它的一个功能是数字识别,但我在互联网上看到的只是检测简单的手势,比如向左向右自上而下的圆圈等。
但我需要的是检测数字的手势,我知道这是可能的,但我真的在互联网上找不到任何关于数字识别的东西,你知道的任何教程可以帮助我做到这一点吗?
手势识别并不像您想象的那么复杂。基本思想是将你的“写作”分成几个简单的动作(如滑动)。
我会尝试以下方法:
一些例子:
当然,您需要一些近似值和容差,并且您可能希望重用现有库,但这也取决于实际任务(例如,您可能被迫从头开始编写一些东西)。
试试这个http://www.photonstorm.com/phaser
它说:
Talk to a Phaser.Pointer and it doesn’t matter if the input came from a touch-screen or mouse, it can even change mid-game without dropping a beat. Multi-touch, Mouse, Keyboard and lots of useful functions allow you to code custom gesture recognition.
我认为您需要自定义手势识别。
您可以通过提供点数组来定义自己的手势,这些点定义形状并为每个形状提供回调函数。
Javascript手势识别:
http://webcodingeasy.com/JS-classes/Javascript-gesture-recognition