AS3 中的惯性拖动(傻瓜版)
我正在尝试创建一个限制于 x 轴的拖动惯性效果。我知道这个问题之前在这里被问过,但我无法理解答案!
我目前正在使用 startDrag 和 stopDrag。我假设我应该在 startDrag 函数中添加一些内容来捕获用户移动鼠标的速度,但我不确定这是如何完成的。我想然后我会在 stopDrag 函数中添加一些东西,该函数会启动并使对象继续以该速度移动,然后停止。
有什么建议吗?
I'm trying to create an inertia effect for dragging that's constricted to the x axis. I know this questions was asked before here but I couldn't understand the answer!
I'm currently using startDrag and stopDrag. I'm assuming I should add something to the startDrag function that captures the speed in which the user is moving the mouse, but I'm not sure how this is done. I guess then I'd add something to the stopDrag function that kicks in and makes the object keep moving at that speed and then come to a stop.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个很好的在线教程,里面有答案。我只是在修改代码。作者甚至还提供 .fla 文件可供下载。
http://www.quasiuseful.com/?id=11
I've found an grat online tutorial that has the answer. I was a matter of tinkering with the code. The writer even has .fla files for download.
http://www.quasiuseful.com/?id=11