From cc8658aac64fcd1ed70f5337a6001a3c9521b4ca Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Thu, 4 Aug 2022 13:34:30 +0800 Subject: [PATCH] fix(useTransition): improve type of `TransitionPresets` close #2019 --- packages/core/useTransition/index.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/core/useTransition/index.ts b/packages/core/useTransition/index.ts index de5ef88b5fa..ba315ffc95c 100644 --- a/packages/core/useTransition/index.ts +++ b/packages/core/useTransition/index.ts @@ -7,12 +7,12 @@ import { useRafFn } from '../useRafFn' /** * Cubic bezier points */ -type CubicBezierPoints = [number, number, number, number] +export type CubicBezierPoints = [number, number, number, number] /** * Easing function */ -type EasingFunction = (n: number) => number +export type EasingFunction = (n: number) => number /** * Transition options @@ -49,13 +49,7 @@ export interface UseTransitionOptions { transition?: MaybeRef } -/** - * Common transitions - * - * @see https://easings.net - */ -export const TransitionPresets: Record = { - linear, +export const _TransitionPresets = { easeInSine: [0.12, 0, 0.39, 0], easeOutSine: [0.61, 1, 0.88, 1], easeInOutSine: [0.37, 0, 0.63, 1], @@ -80,7 +74,17 @@ export const TransitionPresets: Record & { linear: EasingFunction } /** * Create an easing function from cubic bezier points.