How to detect specific time in animation

I am using Cocos Creator 3.

I have a ball spin animation and I wanted to detect specific time in that animation. Say after 20 sec. I want to do something else.

 this._ballAnimation?.play('spin);
 this._spinAnimationState = this._ballAnimation?.getState('spin');

I could track the
this._spinAnimationState.current
in update function and detect specific time.

But is there another way of doing this?

That’s the way to do it, AnimationState is designed for precise control or information of an animation.