diff --git a/src/core/render/utils.ts b/src/core/render/utils.ts index 34a5b73..bba3f00 100644 --- a/src/core/render/utils.ts +++ b/src/core/render/utils.ts @@ -1,3 +1,4 @@ +import { TimingFn } from 'mutate-animate'; import { RenderAdapter } from './adapter'; import { FloorViewport } from './preset/viewport'; @@ -12,3 +13,17 @@ export function enableViewport() { if (!adapter) return; adapter.sync('disable'); } + +/** + * 将两个缓动函数做加法 + */ +export function AddTiming(timing1: TimingFn, timing2: TimingFn): TimingFn { + return (p: number) => timing1(p) + timing2(p); +} + +/** + * 将两个缓动函数做乘法 + */ +export function multiplyTiming(timing1: TimingFn, timing2: TimingFn): TimingFn { + return (p: number) => timing1(p) * timing2(p); +}