From 0c3c099b19d71d662fed99666dd4e5ae0879f9ff Mon Sep 17 00:00:00 2001 From: Abdelrahman Ashraf Date: Sat, 14 Dec 2024 19:44:33 +0700 Subject: [PATCH] feat(viewer): add a checkbox for enabling/disabling dotLottie frame interpolation in perf-test page --- apps/dotlottie-viewer/src/pages/perf.tsx | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/apps/dotlottie-viewer/src/pages/perf.tsx b/apps/dotlottie-viewer/src/pages/perf.tsx index e47472bb..d98b96bd 100644 --- a/apps/dotlottie-viewer/src/pages/perf.tsx +++ b/apps/dotlottie-viewer/src/pages/perf.tsx @@ -135,12 +135,16 @@ export const Perf = (): JSX.Element => { const [player, setPlayer] = useState(playerOptions[0]); const [animationList, setAnimationList] = useState([]); const [text, setText] = useState(''); + const [useFrameInterpolation, setUseFrameInterpolation] = useState(true); useEffect(() => { const params = new URLSearchParams(window.location.search); const playerParam = params.get('player'); const countParam = params.get('count'); const seed = params.get('seed'); + const frameInterpolation = params.get('frame-interpolation'); + + setUseFrameInterpolation(frameInterpolation === null || frameInterpolation === 'true'); const selectedCount = countOptions.find((c) => c.name === countParam) || countOptions[1]; const selectedPlayer = playerOptions.find((p) => p.name === playerParam) || playerOptions[0]; @@ -265,6 +269,21 @@ export const Perf = (): JSX.Element => { > Set +
+ {(player.id === 0 || player.id === 1) && ( +
+ { + setQueryStringParameter('frame-interpolation', e.target.checked.toString()); + window.location.reload(); + }} + /> + Use Frame Interpolation +
+ )} +
@@ -287,8 +306,24 @@ export const Perf = (): JSX.Element => {
    {animationList.map((anim, index) => (
  • - {player.id === 0 && } - {player.id === 1 && } + {player.id === 0 && ( + + )} + {player.id === 1 && ( + + )} {player.id === 2 && } {player.id === 3 && }

    {anim.name}