krosshj
krosshj

Reputation: 877

why the interval of invoking applyTransformation() is about 16ms?

recently, I am researching the system implement of android.view.animation.Animation.

I override the Animation.applyTransformation() method, and log the invoking interval time, it's about 16ms.

16ms' interval means 60fps. This make the animation plays smoothly.

But why is 16ms? Who control this?

If I implement a animation thread to implement custom animation, I usually do postDelayed(this, 16), so that my Thread will run at 60fps, each time post a message to Handler ,tell it to do some UI change on Main Thread.

How about android system?

Upvotes: 1

Views: 174

Answers (1)

Alex Lockwood
Alex Lockwood

Reputation: 83311

I think you are looking for the Choreographer class:

Coordinates the timing of animations, input and drawing. The choreographer receives timing pulses (such as vertical synchronization) from the display subsystem then schedules work to occur as part of rendering the next display frame.

Upvotes: 2

Related Questions