Android lock screen fluorescent effect

preface

This is a blog post written a few months ago. I feel perfunctory after reading it before going to bed. I'd better change it and send it again.

The previous blog made a lock screen application. In the past, various cool lock screen effects were very popular. Sometimes I went to the lock screen market to see what special effects I like. I found a cool fluorescent unlocking effect, so I thought about whether I could realize it myself.

Screen lock effect:

Principle:

The principle of locking screen has been introduced in previous chapters. Here we mainly talk about the realization of fluorescence effect.

Key points of principle:

1) As for fluorescent points, each fluorescent store is an object entity, so we construct it as a class, which has its own properties, such as fluorescence start time, radius of fluorescent points, life cycle of fluorescent points, etc.

2) Realization of fluorescence luminescence

From the effect of the lock screen theme, we can see that the fluorescent points shine first, and then the brightness decreases as the radius decreases. The lighting effect can be achieved through the RadialGradient class rendering. At the same time, we can make the fluorescent points look smaller by gradually changing the radius.

3) About the effect of scattered and shining fluorescent points

The effect of how a fluorescent point emits light is realized. Next, we want to realize a pile of fluorescent points. In order to make the fluorescent effect look natural, of course, we can't generate a pile of fluorescent points at the same time. We want to create a "random" effect, that is, the timing of random generation, random quantity, random size and random coordinates.

Generate a random number of fluorescent points through random numbers. At this time, the coordinates and radius of fluorescent points are also generated randomly (see the construction method of fluorescent points for details)

4) About logical processing

The logical processing is very simple. We only need to process the touch event in the ontouchevent () method and generate random fluorescent points.

The code is finished, which is relatively simple. If there are errors and omissions, please correct them

Code portal: Android achieves fluorescent effect

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