中断动画

发布于 2024-12-27 21:23:22 字数 330 浏览 3 评论 0原文

想象一下 Windows Phone。

有一个球(一个圆)。

当您点击某处时,球会移向该点击处。

当它到达那个位置时,它就会停下来。

你点击其他地方。

球向第二个位置移动。

但是,在它到达目的地之前,您点击了其他地方。第三次点击。

现在球改变方向朝向第三次点击。

朝点击方向移动 - 这是一个简单的动画。

中途改变航向; 你是怎么做到的?

如果我只是停止第一个动画,就没有缓动。

我需要温和、顺利地改变路线。

一个想法?

Picture a Windows Phone.

There is a ball (a circle).

When you tap somewhere the ball moves toward that tap.

When it reaches that spot, it stops.

You tap somewhere else.

The ball moves toward that second spot.

BUT, before it reaches its destination, you tap somewhere else. A third tap.

Now the ball changes directions toward the third tap.

To move toward a tap - this is a simple animation.

To change course mid-stream; how do you do that?

If I simply stop the first animation, there is no easing.

I need to change courses gently, smoothly.

An ideas?

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

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

发布评论

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

评论(1

从此见与不见 2025-01-03 21:23:22

如果您希望缓动停止在球位于点 2 的位置,然后缓动开始移动到点 3,我会执行以下操作:

  1. 将端点(第二个点)修改为距球当前位置 10-20 像素向第二个地点的方向。
  2. 当该位置到达新的第二位置时,开始向第三位置移动。

这是一个可以提供帮助的图表:

在此处输入图像描述

If you want the easing to stop right where the ball is at point 2 and then the easing to start moving to point 3, I would do something like this:

  1. Modify endpoint (second spot) to be 10-20 pixels from the balls current location in the direction of second spot.
  2. When the spot reaches the new second spot, start moving toward spot three.

Here is a diagram to help:

enter image description here

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