diff --git a/examples/resize-test/README.md b/examples/resize-test/README.md new file mode 100644 index 0000000..3f5c825 --- /dev/null +++ b/examples/resize-test/README.md @@ -0,0 +1,32 @@ +# To run + +This is a basic showcase of a resize issue we have, to test this locally with rive-react changes + +1. run `npm start` +2. run `npm run build` for the rive-react project + +If you want to also test local wasm changes: + +1. update `rive-react`/package.json to a locally checked out version of rive-wasm's canvas_single +`"@rive-app/canvas": "../rive-wasm/js/npm/canvas_single",` +2. cd to `rive-wasm/js` & run `npm run dev` (keep this going as it will watch for changes) +3. run `npm start` +4. run `npm run build` for the rive-react project + + +# Resize issue: + +update parameters in `utils.ts` to see this for yourself. + +Resizing from window.resize + - bottom animation moves slower than rest + - cannot deal with the animations container resizing, unless its linked to the window resizing +Resizing from ResizeObserver + - all animations move together super smooth when resizing + - top two animations flicker to white (blank canvas) when resizing +Resizing form ResizeObserver - throttled (current default) + - all animations move "together" + - resizing looks pretty smooth, but everything lags behind a bit. + +# Other issues +its also very slow resizing when dev tools is open, its fine when closed though. \ No newline at end of file diff --git a/examples/resize-test/package.json b/examples/resize-test/package.json new file mode 100644 index 0000000..91b1ce1 --- /dev/null +++ b/examples/resize-test/package.json @@ -0,0 +1,36 @@ +{ + "name": "basic-with-hook", + "version": "0.1.0", + "private": true, + "dependencies": { + "@testing-library/jest-dom": "^5.13.0", + "@testing-library/react": "^11.2.7", + "@testing-library/user-event": "^12.8.3", + "react": "file:../../node_modules/react", + "react-dom": "^17.0.2", + "react-scripts": "4.0.3", + "rive-react": "file:../..", + "web-vitals": "^1.1.2" + }, + "scripts": { + "start": "SKIP_PREFLIGHT_CHECK=true react-scripts start" + }, + "eslintConfig": { + "extends": [ + "react-app", + "react-app/jest" + ] + }, + "browserslist": { + "production": [ + ">0.2%", + "not dead", + "not op_mini all" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + } +} diff --git a/examples/resize-test/public/index.html b/examples/resize-test/public/index.html new file mode 100644 index 0000000..ade00a9 --- /dev/null +++ b/examples/resize-test/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + Rive React - Basic with Hook + + + +
+ + diff --git a/examples/resize-test/public/magic-ball.riv b/examples/resize-test/public/magic-ball.riv new file mode 100644 index 0000000..f4cce41 Binary files /dev/null and b/examples/resize-test/public/magic-ball.riv differ diff --git a/examples/resize-test/public/poison-loader.riv b/examples/resize-test/public/poison-loader.riv new file mode 100644 index 0000000..a946fa4 Binary files /dev/null and b/examples/resize-test/public/poison-loader.riv differ diff --git a/examples/resize-test/src/App.js b/examples/resize-test/src/App.js new file mode 100644 index 0000000..577d3b3 --- /dev/null +++ b/examples/resize-test/src/App.js @@ -0,0 +1,30 @@ +import { useRive } from 'rive-react'; + +function App() { + const params = { + src: 'poison-loader.riv', + autoplay: true, + }; + + const { RiveComponent: RiveComponentBasic } = useRive(params); + const { RiveComponent: RiveComponentBasic2 } = useRive(params); + const { RiveComponent: RiveComponentBasic3 } = useRive(params); + + return ( + <> +
+
+ +
+
+ +
+
+ +
+
+ + ); +} + +export default App; diff --git a/examples/resize-test/src/index.js b/examples/resize-test/src/index.js new file mode 100644 index 0000000..c1f31c5 --- /dev/null +++ b/examples/resize-test/src/index.js @@ -0,0 +1,10 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +ReactDOM.render( + + + , + document.getElementById('root') +);