Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions perf-test/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,7 @@ const countOptions = [
//{ id: 6, name: 1000 },
];

const playerOptions = [
{ id: 1, name: 'ThorVG(Software)' },
{ id: 2, name: 'ThorVG(WebGPU)' },
//{ id: 3, name: `dotlottie-web@${dotLottieReactPkg.dependencies["@lottiefiles/dotlottie-web"]}` },
//{ id: 4, name: `lottie-web@${reactLottiePlayerPkg.dependencies["lottie-web"]}` },
//{ id: 5, name: 'skia/skottie' },
];
const playerOptions = createAvailablePlayerOptions();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

const playerOptions = playerOptions = [
    { id: 1, name: 'ThorVG(Software)' }
];

if (navigator.gpu) {
    playerOptions.push({ id: 2, name: 'ThorVG(WebGPU)' });
}


function classNames(...classes: any) {
return classes.filter(Boolean).join(' ')
Expand All @@ -148,6 +142,22 @@ function setQueryStringParameter(name: string, value: any) {
window.history.replaceState({}, '', decodeURIComponent(`${window.location.pathname}?${params}`));
}

function createAvailablePlayerOptions() {
let playerOptions = [
{ id: 1, name: 'ThorVG(Software)' },
{ id: 2, name: 'ThorVG(WebGPU)' },
//{ id: 3, name: `dotlottie-web@${dotLottieReactPkg.dependencies["@lottiefiles/dotlottie-web"]}` },
//{ id: 4, name: `lottie-web@${reactLottiePlayerPkg.dependencies["lottie-web"]}` },
//{ id: 5, name: 'skia/skottie' },
];

if (!navigator.gpu) {
playerOptions = playerOptions.filter(({ name }) => name !== 'ThorVG(WebGPU)');
}

return playerOptions;
}

export default function Home() {
const size = isMobile ? { width: 150, height: 150 } : { width: 180, height: 180};
let initialized = false;
Expand Down