From 67d425d4ab559655c732cd83568a05e0549c4b5a Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Sat, 5 Oct 2024 23:23:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BC=93=E5=8A=A8=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=8A=A0=E6=B3=95=E4=B8=8E=E4=B9=98=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/render/utils.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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); +}