顺利抓住 [英] Smooth grabbing

查看:140
本文介绍了顺利抓住的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个简单的抓取演示页面。它没有任何缓和/加速。我想使用JavaScript执行与 kulesh.info (Flash网站)相同的缓动/加速。我怎么能这样做?

I've made a simple grabbing demo page. It doesn't have any easing/acceleration. I would like to do the same easing/acceleration as on kulesh.info (Flash website) using JavaScript. How can I do that?

在JavaScript中平滑抓取(滚动,拖动)的任何例子都是有用的,也是一种与语言无关的算法。

Any examples of smooth grabbing (scrolling, dragging) in JavaScript would be helpful as well as a language agnostic algorithm.

推荐答案

你可以使用有时被称为zeno悖论的缓动方程来获得闪光外观。

You can get the flash look by using an easing equation sometimes referred to as zeno's paradox.

position += (destination - position) / damping

我修改了你的jsFiddle来使用它:看看

I modified your jsFiddle to make use of it: Have a look

如果您希望我对zeno悖论进行更详细的描述,请告诉我,我会在这里张贴一张或两张图片。

If you'd like me to give a more detailed description of zeno's paradox, let me know and I'll post one here with an image or two.

这篇关于顺利抓住的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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