An overview of the
I saw this animation under the UI Movement theme while I was swiping instant a while back. I thought it was very simple and the effect was good, so I tried it myself. Before are most of the time is to use the open source library, through this small project I also feel a complete open source experience 🤣
No one would be interested in the “principle” of such a simple effect🤔
Feel the
-
UI Movement effect
-
Final effect 😝
usage
- Duration: length
- Orientation: the direction
- Reverse: Animation is reversed
- StartColor: animation startColor
- EndColor: endColor of animation
- StrokeWidth: brush width (1.0F for filling the entire container)
- StrokeCap: brush head trait
implementation 'com. Making. Tommytc: BrushEffect: 1.0.0'
Copy the code
<com.github.tommytc.lib.brusheffect.BrushEffectLayout
android:id="@+id/layoutTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:bel_duration="400"
app:bel_orientation="horizontal"
app:bel_reverse="true"
app:bel_startColor="@color/colorAccent"
app:bel_endColor="@color/colorAccent"
app:bel_strokeWidth="1.0"
app:bel_strokeCap="square">
<Your view/>
</com.github.tommytc.lib.brusheffect.BrushEffectLayout>
Copy the code
//Set interpolators
brushEffectLayout.setInInterpolator();
brushEffectLayout.setOutInterpolator();
//Set a listener
brushEffectLayout.setListener(new BrushEffectLayout.Listener() {
public void onStart(a) {}public void onCover(a) {}public void onFinish(a) {}});//Start
brushEffectLayout.brush();
//End
brushEffectLayout.hide();
Copy the code
Repo
- Github
- Gitee