你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
发现
话题
全文搜索
登录
[]请问如何获取触屏上两个或者更多位置的坐标
我已经看过用两个手指旋转的demo 现在想问 能否可以在两个手指都按下去且不动的情况下 还能不断获取坐标
demo必须触发事件才能获取坐标 但是如果我一直按着不动就无法触发了
mouseXmouseY只能获取一个点的坐标
没有找到相关结果
已邀请:
与内容相关的链接
提交
1 个回复
wudi199553
赞同来自:
private onMouseDown(e: Event): void {
var touches: Array<any> = e.touches;
if (touches && touches.length == 2) {
this.preRadian = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove);
}
}
private onMouseMove(e: Event): void {
var touches: Array<any> = e.touches;
if (touches && touches.length == 2)
{
var nowRadian: number = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
this.sp.rotation += 180 / Math.PI * (nowRadian - this.preRadian);
length==2就是两根手指, 把他改成你想要的数量不久可以了么,他不是根据mousex,y;而是根据 touches[0].stageY - touches[1].stageY,
要回复问题请先
登录
发起人
klm123698745
相关问题
两个对象new了一个相同的对象,调用第一个的一个方法,走进了第二方法里
请问LayaAir中如何使图片以圆形的方式显示?
请问有没有方法能够获取“鼠标是否处于按下状态”?
请问laya有没有地图编辑器工具?
招聘:H5游戏开发 坐标:深圳南山
请问下加载TFF字体要怎么加载呢?
从unity导出的场景透贴和模型烘焙的灯光不显示,请问有知道是什么原因的吗?~~~~~~~~~~~~~
localToGlobal坐标转换
Animator 如何获取当前所有动画名称呢?或者所有的AnimationClip呢?
Laya2.6.0beta 物理引擎 刚体碰撞点位置获取不正确
如何获取图片每个像素点的RGB?
问题状态
最新活动:
2017-12-01 11:45
浏览:
3664
关注:
2
人
商务合作
1 个回复
wudi199553
赞同来自:
var touches: Array<any> = e.touches;
if (touches && touches.length == 2) {
this.preRadian = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
Laya.stage.on(Event.MOUSE_MOVE, this, this.onMouseMove);
}
}
private onMouseMove(e: Event): void {
var touches: Array<any> = e.touches;
if (touches && touches.length == 2)
{
var nowRadian: number = Math.atan2(
touches[0].stageY - touches[1].stageY,
touches[0].stageX - touches[1].stageX);
this.sp.rotation += 180 / Math.PI * (nowRadian - this.preRadian);
length==2就是两根手指, 把他改成你想要的数量不久可以了么,他不是根据mousex,y;而是根据 touches[0].stageY - touches[1].stageY,