game-ar-hand
v0.0.1
Published
``` npm install game-ar-hand ```
Downloads
1
Readme
game-ar-hand
ar识别手
安装
npm install game-ar-hand
使用
- json
{
"usingComponents": {
"ar-hand": "game-ar-hand/ar-hand"
}
}
- js
Page({
data: {
points: []
},
onClickFun() {
if (this.data.points.length <= 0) { return false; }
my.alert({
content: "识别成功后点击"
});
},
onError() {
this.setData({ points: [] })
console.log("识别失败")
},
onSuccess(anchor) {
console.log("识别成功")
this.setData({
points: [
{ x: anchor[1], y: anchor[2] },
{ x: anchor[3], y: anchor[4] },
]
})
},
});
- xaml
<view style="position:fixed;left:0;top:0;width:100%;height:100%;">
<ar-hand onError="onError" onSuccess="onSuccess" />
</view>
<view style="width:100rpx;height:100rpx;border-radius:50%;position:absolute;left:50%;bottom:100rpx;background:{{points.length<=0?'#ccc':'#fff'}};margin-left:-50rpx;" onTap="onClickFun"></view>