为此使用了什么样的动画?

发布于 2025-01-06 18:13:07 字数 318 浏览 3 评论 0原文

任何熟悉模拟器的人都会知道,在加载阶段,AVD 的“屏幕”会显示“android”一词,如下图所示...

在此处输入图像描述 突出

显示(图像中的字母 DRO 上)从左到右“扫描”以充当不确定的进度指示器。

我不做太多图形工作,所以我不熟悉不同的动画技术。这种类型的动画常见吗?如果常见,它的名字是什么?

我想在我的主要活动的标题栏中实现类似的东西。打开时,它将对活动名称进行一次突出显示“扫描”。除了为用户体验添加一点“浮华”之外,没有任何真正的目的。

Anyone familiar with the emulator will know that during the loading phase the 'screen' of the AVD shows the word 'android' as in the image below...

enter image description here

The highlight (on the letters DRO in the image) 'scans' from left to right to act as an indeterminate progress indicator.

I don't do much graphics work so I'm not familiar with different animation techniques. Is that type of animation a common one and if so, what is it's name?

I'd like to implement something similar in my main activity's title bar. When opened, it would do a single highlight 'scan' of the activity name. No real purpose other than to add a bit of 'glitz' to the UX.

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

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

发布评论

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

评论(1

前事休说 2025-01-13 18:13:07

这很可能是一个位图动画(精灵动画)或两个图像,其中一个是放在顶部的效果层。

精灵动画只是放置一个预渲染的图像集,其中帧仅以指定的速率切换。

另一种选择是部分透明的蒙版,它在背景图像上从左到右进行动画处理。

为了说明第二点:

  1. 首先您有背景图像:

background

  1. ​​ 然后您有蒙版。请注意,白色和白色透明的效果不太好。这也是图像的链接:https://i.sstatic.net/t6QsK.png

mask

  1. 与遮罩的偏移量结合使用时,您会得到类似

combined

因此,您只需在背景图像上绘制蒙版,Alpha 混合就会处理剩下的事情。
最简单的方法可能是将 imageview 从 0-mask.width 的位置动画到 background.width+mask.width 的位置。

如果您希望蒙版更加动态,您可能需要生成并渲染它,例如在自定义视图中,在 onDraw 中将其绘制到画布上。
如果使用 AnimationSet(或 Animator,具体取决于 Android 目标)将其与旋转结合起来,可以使效果更酷一些。

That is most likely a bitmap animation (sprite animation) or two images where one is the effect layer put on top.

A sprite animation is simply put a prerendered imageset where the frames are just switched at a specified rate.

The other alternative is a partly transparent mask that is animated over the background image from left to right.

To illustrate the second point:

  1. First you have the background image:

background

  1. Then you have the mask. Note that white and transparent on white doesn't show that well. Here's a link to the image as well: https://i.sstatic.net/t6QsK.png

mask

  1. When combined with an offset of the mask you get something like

combined

So you simply draw the mask over the background image and alpha blending will take care of the rest.
The simplest way is probably to animate an imageview from a position that is 0-mask.width to a position that is background.width+mask.width.

If you want the mask to be more dynamic you will probably want to generate and render it for example in a custom view where you draw in onDraw to a canvas.
You could make the effect a bit cooler if you combine it with a rotation using an AnimationSet (or Animator depending on Android target).

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