Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 WebGPU & WebGL renderers #450

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
22 changes: 22 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"mode": "pre",
"tag": "pre",
"initialVersions": {
"dotlottie-next-example": "0.0.0",
"dotlottie-react-example": "0.0.0",
"dotlottie-solid-example": "0.0.0",
"dotlottie-viewer": "0.0.1",
"dotlottie-vue-example": "0.0.0",
"dotlottie-wc-example": "0.0.0",
"dotlottie-web-example": "0.0.0",
"dotlottie-web-node-example": "0.0.0",
"with-parcel-example": "0.0.0",
"@lottiefiles/dotlottie-react": "0.12.1",
"@lottiefiles/dotlottie-solid": "0.1.5",
"@lottiefiles/dotlottie-svelte": "0.4.4",
"@lottiefiles/dotlottie-vue": "0.5.4",
"@lottiefiles/dotlottie-wc": "0.4.2",
"@lottiefiles/dotlottie-web": "0.39.0"
},
"changesets": ["moody-otters-sniff", "thirty-cobras-perform"]
}
5 changes: 5 additions & 0 deletions .changeset/thirty-cobras-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/dotlottie-web': minor
---

feat: 🎸 WebGPU & WebGL renderers
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ on:
push:
branches:
- main
pull_request:
- feat/web-gpu-gl
# pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -218,9 +219,7 @@ jobs:
name: publish-viewer
needs: validate
runs-on: ubuntu-latest
if:
${{ github.repository == 'LottieFiles/dotlottie-web' && github.event_name == 'push' && github.ref ==
'refs/heads/main' }}
if: ${{ github.repository == 'LottieFiles/dotlottie-web' && github.event_name == 'push' }}

permissions:
contents: write
Expand Down
37 changes: 32 additions & 5 deletions apps/dotlottie-viewer/src/pages/perf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ const countOptions = [

const playerOptions = [
{ id: 0, name: 'dotlottie-web' },
{ id: 1, name: 'dotlottie-web/worker' },
{ id: 2, name: 'lottie-web' },
{ id: 3, name: 'skia/skottie' },
{ id: 1, name: 'dotlottie-web/wg' },
{ id: 2, name: 'dotlottie-web/gl' },
{ id: 3, name: 'dotlottie-web/worker' },
{ id: 4, name: 'lottie-web' },
{ id: 5, name: 'skia/skottie' },
];

export const Perf = (): JSX.Element => {
Expand Down Expand Up @@ -315,7 +317,32 @@ export const Perf = (): JSX.Element => {
useFrameInterpolation={useFrameInterpolation}
/>
)}

{player.id === 1 && (
<DotLottieReact
src={anim.lottieURL}
style={size}
loop
autoplay
useFrameInterpolation={useFrameInterpolation}
renderConfig={{
renderer: 'wg',
}}
/>
)}
{player.id === 2 && (
<DotLottieReact
src={anim.lottieURL}
style={size}
loop
autoplay
useFrameInterpolation={useFrameInterpolation}
renderConfig={{
renderer: 'gl',
}}
/>
)}
{player.id === 3 && (
<DotLottieWorkerReact
src={anim.lottieURL}
style={size}
Expand All @@ -324,8 +351,8 @@ export const Perf = (): JSX.Element => {
useFrameInterpolation={useFrameInterpolation}
/>
)}
{player.id === 2 && <LottieWeb src={anim.lottieURL} style={size} loop autoplay />}
{player.id === 3 && <SkottiePlayer lottieURL={anim.lottieURL} width={size.width} height={size.height} />}
{player.id === 4 && <LottieWeb src={anim.lottieURL} style={size} loop autoplay />}
{player.id === 5 && <SkottiePlayer lottieURL={anim.lottieURL} width={size.width} height={size.height} />}
<h3 className="mt-6 text-lg font-semibold text-white">{anim.name}</h3>
<p className="text-sm text-gray-500">{anim.location}</p>
</li>
Expand Down
4 changes: 4 additions & 0 deletions apps/dotlottie-web-example/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@
backgroundColor,
renderConfig: {
autoResize: true,
renderer: 'gl',
},
useFrameInterpolation: false,
});

dotLottie.addEventListener('loadError', console.error);

Check warning on line 172 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement
dotLottie.addEventListener('freeze', console.log);

Check warning on line 173 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement
dotLottie.addEventListener('unfreeze', console.log);

Check warning on line 174 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement

// window.addEventListener('resize', () => {
// dotLottie.resize();
Expand Down Expand Up @@ -205,6 +206,9 @@
speed: 1,
backgroundColor: '#800080ff',
themeId: 'animated_light',
renderConfig: {
renderer: 'wg',
},
// useFrameInterpolation: false,
});

Expand All @@ -223,7 +227,7 @@
dotLottie.postPointerDownEvent(0, 0);
});

dotLottie.addEventListener('loadError', console.error);

Check warning on line 230 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement

const playPauseButton = document.getElementById('playPause') as HTMLButtonElement;
const stopButton = document.getElementById('stop') as HTMLButtonElement;
Expand Down Expand Up @@ -344,9 +348,9 @@

themeSelect.addEventListener('change', () => {
if (themeSelect.value) {
console.log(dotLottie.setTheme(themeSelect.value));

Check warning on line 351 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement
} else {
console.log(dotLottie.resetTheme());

Check warning on line 353 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement
}
});

Expand Down Expand Up @@ -419,7 +423,7 @@
});

dotLottie.addEventListener('ready', (event) => {
console.log(event, dotLottie.isReady);

Check warning on line 426 in apps/dotlottie-web-example/src/main.ts

View workflow job for this annotation

GitHub Actions / validate

Unexpected console statement
});

dotLottie.addEventListener('load', (event) => {
Expand Down
1 change: 0 additions & 1 deletion apps/with-parcel-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"type": "module",
"private": true,
"scripts": {
"build": "parcel build index.html --no-cache",
"dev": "parcel index.html --no-cache --open"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@types/node": "^20.14.11",
"@vitest/browser": "2.1.0-beta.5",
"@vitest/coverage-istanbul": "2.1.0-beta.5",
"@webgpu/types": "^0.1.53",
"cross-env": "7.0.3",
"esbuild": "^0.23.0",
"esbuild-plugin-replace": "^1.4.0",
Expand Down
Loading
Loading