Android uses surfaceview to realize floating praise animation

Recently, live broadcast is too laggy. When you mention animation, you think of using View's attribute animation. Later, you think about it, so many users will praise you. It will cause many View on screen. If you spend too much money, you will be stuck. So, what's the solution for the mainstream anchorage software?

So I decompiled the Yingke APK and took a look at it. Its praise uses only one surfaceview, and each heart is painted on the canvas in real time. This is really efficient, and no matter how many hearts are not afraid. There was a train of thought, but it was troublesome to write from beginning to end. Later, I checked online to see if anyone else had done it? Sure enough, there are ready-made. The idea is very clear and concise. Just change it according to your own needs.

I mentioned a lot earlier. I mainly want to explain that although I haven't done some effects, I can refer to how other mature products do them. This will reduce detours. Just imagine that if I only use view attribute animation and realize it, I'm going to die. Finally, I have to push it down and redo it.

Let's see the effect first:

Zanbean class. Each zanbean is responsible for updating its own location, transparency and other data in real time

The zanview code is as follows: surfaceview, constantly painting zanbean on its own canvas.

Call method:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>