动画期间的jQuery碰撞检测 [英] jQuery collision detection during animation

查看:83
本文介绍了动画期间的jQuery碰撞检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让黑匣子检测它是否会在有边框上碰撞。
如果黑匣子检测到碰撞,它会四处移动并转到用户点击的位置。

I wanted the black box to detect if it is going to collide on the bordered box. If the black box detected a collision it will move around and go to the position clicked by the user.

如何使用jquery执行此操作?

How to do this with jquery?

推荐答案

您可以尝试 jquery -collision 。完全披露:我刚刚写了并发布了这个。我也遇到了同样的问题,没有看到解决方案,所以我自己写了。

You can try jquery-collision. Full disclosure: I just wrote and released this. I also ran into this same issue, didn't see a solution, so I wrote it myself.

它允许你这样做:

var hit_list = $("#me").collision("#center");

它将返回与#me重叠的#center。 (或者没有。)

and it will return the "#center"'s that overlap with "#me". (Or none.)

这篇关于动画期间的jQuery碰撞检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆