Interface: AnimationHandle
November 28, 2023 · View on GitHub
Handle of useAnimation.
Type parameters
| Name | Type | Description |
|---|---|---|
Args | void | argument type |
Hierarchy
-
BaseAnimationHandle<Args>↳
AnimationHandle
Callable
AnimationHandle
▸ AnimationHandle(ref): void
You have to pass this callback to ref of element you want to control.
Parameters
| Name | Type |
|---|---|
ref | null | Element |
Returns
void
Defined in
src/react/hooks/useAnimation.ts:97
Table of contents
Methods
Methods
play
▸ play(...opts): BaseAnimationHandle<Args>
A wrapper of Web Animations API's play. It's similar to GSAP's play().
Parameters
| Name | Type |
|---|---|
...opts | Args extends void ? [PlayOptions?] : [PlayOptionsWithArgs<Args>] |
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:44
reverse
▸ reverse(): BaseAnimationHandle<Args>
A wrapper of Web Animations API's reverse. It's similar to GSAP's reverse().
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:50
cancel
▸ cancel(): BaseAnimationHandle<Args>
A wrapper of Web Animations API's cancel. It's similar to GSAP's kill().
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:54
finish
▸ finish(): BaseAnimationHandle<Args>
A wrapper of Web Animations API's finish.
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:58
pause
▸ pause(): BaseAnimationHandle<Args>
A wrapper of Web Animations API's pause. It's similar to GSAP's pause().
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:62
setTime
▸ setTime(time): BaseAnimationHandle<Args>
A setter of Web Animations API's currentTime. It's similar to GSAP's seek().
If you pass function, you can get endTime from its argument.
Parameters
| Name | Type |
|---|---|
time | number | (endTime: number) => number |
Returns
BaseAnimationHandle<Args>
Inherited from
Defined in
src/react/hooks/useAnimation.ts:68
setPlaybackRate
▸ setPlaybackRate(rate): BaseAnimationHandle<Args>
A wrapper of Web Animations API's updatePlaybackRate. It's similar to GSAP's timeScale().
If you pass function, you can get current playbackRate from its argument.
Parameters
| Name | Type |
|---|---|
rate | number | (prevRate: number) => number |
Returns
BaseAnimationHandle<Args>
Inherited from
BaseAnimationHandle.setPlaybackRate
Defined in
src/react/hooks/useAnimation.ts:76
waitFor
▸ waitFor(event): Promise<BaseAnimationHandle<Args>>
A getter of Promise that will be resolved in specified timing.
finished: resolved when animation is finished and its playback direction is normal.reverseFinished: resolved when animation is finished and its playback direction is reversed.
Parameters
| Name | Type |
|---|---|
event | WaitingAnimationEventName |
Returns
Promise<BaseAnimationHandle<Args>>