Android control realizes the praise floating heart animation of live app special effects

Now there are a large number of live broadcast applications on the market. You can develop a live broadcast app with any theme. Frankly, you want to take a share in this field. In the process of using these applications, it is not difficult to find that in all live broadcast interfaces, all kinds of rewards and likes are indispensable. Today, I knocked on the praise function. There are not many codes, mainly related to the operation of animation trajectory. Here, I need to use the relevant knowledge of Bezier curve. I use the third-order Bezier curve to realize trajectory animation.

Operation effect

1、 Specific implementation process

After careful analysis of the whole process, it can be found that the first is the animation of "love", and then "love" moves upward in the form of bubbles.

Animation of "love"

Here, attribute animation is used to change the state of the "love" picture control on the screen, specifically using attribute animation such as control transparency alpha, control scaling degree scale, etc.

Floating track animation of "love"

Here, we need to customize an evaluation algorithm curveevaluator, because "love" does not move in a straight line, but floats upward through an irregular curve. We know that the function of typeevaluator is to set the current value of control properties according to the change rate of animation. The specific algorithm is to use the third-order Bessel curve formula:

P0 is the starting point of the animation, P3 is the end point of the animation, and the other two points P1 and P2 are the control points of the third-order Bezier curve. What specific P1 and P2 values are going to? It's almost OK based on experience^_^

2、 Use operation

Then you can call the addLikeView () method of the FlowLikeView instance in the click response event. Of course, remember to remove the view from the container after the animation.

Live app special effects like floating heart animation source code download

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
分享
二维码
< <上一篇
下一篇>>