AS2 - 数学过渡帮助

发布于 2024-09-14 02:00:59 字数 147 浏览 2 评论 0原文

我在 Flash 中制作了一个下拉菜单,我希望它能够向下滑动。目前我使用线性幻灯片(_y += 5,_y -= 5)等。

我知道还有其他类型的转换,例如指数等,我将如何实现它们?我还记得曾经有一个网站使用不同的技术在 javascript 中展示了各种幻灯片动画。

im making a drop down menu in flash and i want it to slide down. At the moment im using a linear slide ( _y += 5, _y -= 5) etc.

I know there are other types of transitions like exponential and the like, how would i go about implementing them? I also remember there was a website once that showed all sorts of slide animations in javascript using different techniques.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷→糖丶微凉 2024-09-21 02:00:59

一个简单的幻灯片动画如下:

y = y*(1-speed) + (target_y)*(speed)

迭代导致框滑动,并在移动时减慢速度。速度应介于 0 和 1 之间。速度为 0.5 时,当前与目标之间的距离每时每刻都会减半。

或:

t = 0.1
while y < target_y do
y = y + t
t = t + 0.1
end
y = target_y

这会导致它加速,直到超出目标,然后停止。
作为 + 0.1 的替代方案,您可以执行 * 1.1 或类似的操作,从而引起指数运动,而不是二次运动。

A simple slide animation would be:

y = y*(1-speed) + (target_y)*(speed)

Iterating that causes the box to slide, slowing down as it moves there. Speed should be between 0 and 1. With speed 0.5, the distance between the current and target would be halved every moment.

or:

t = 0.1
while y < target_y do
y = y + t
t = t + 0.1
end
y = target_y

Which causes it to accelerate until it goes beyond the target, where it stops.
As an alternative to + 0.1, you could do * 1.1 or something similar, causing an exponential, rather than quadratic, motion.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文