Skip to content

zhucai/FasterStartAnimatorUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FasterStartAnimatorUtils [Android]

What?

This is a utils to make animator's starting faster about 16.7ms.

Why?

Look at the normal animator's frame sequences:

image

The first frame is doing nothing but wasted 16.7ms. There is a test to prove this behavior: Systrace Result (Source Code)

Usually, we don't want the first frame wasted:

image

We want to start moving immediately!

How?

We can use ValueAnimator.ofFloat(0.2f, 1.f) instead of use ValueAnimator.ofFloat(0.f, 1.f) in this example.
In fact, we need calculate the first parameter in practical use. So there is this stuff.

If you used ValueAnimator.ofFloat(int... values) before, I recommend you using
FasterStartAnimatorUtils.ofFloat(long duration, TimeInterpolator interpolator, float... values) instead.

If you used View.animate().alpha(float value) before, I recommend you using
FasterStartAnimatorUtils.ofFloat(view, Value.ALPHA, duration, interpolator, values) instead.

About

Let the animator start faster 16ms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages