Comments (5)
Thanks. It would be nice to have an example of including a plugin in the documentation.
At the time, I ended up not using this plugin and doing the following:
export default () => {
let targetRef = React.createRef();
React.useEffect(() => {
new p5(sketch2, targetRef.current);
}, []);
return (
<>
<Head>
<script src="/p5/p5.js"></script>
<script src="/p5-play/lib/p5.play.js"></script>
<script src="/p5/addons/p5.sound.min.js"></script>
</Head>
<div ref={targetRef}></div>
</>
);
};
Thanks for the suggestions.
from react.
Yes! I just asked a similar question the other day. If you look at the closed issues that mention how to load p5.sound you will see the solution
from react.
@rchrd2 see this comment which is what @vennsoh is referring to.
If that doesn't help, please just reply with a more specific example and question. Hope it helps though!
from react.
Thanks. It would be nice to have an example of including a plugin in the documentation.
At the time, I ended up not using this plugin and doing the following:
export default () => { let targetRef = React.createRef(); React.useEffect(() => { new p5(sketch2, targetRef.current); }, []); return ( <> <Head> <script src="/p5/p5.js"></script> <script src="/p5-play/lib/p5.play.js"></script> <script src="/p5/addons/p5.sound.min.js"></script> </Head> <div ref={targetRef}></div> </> ); };
Thanks for the suggestions.
Interesting approach! Do you happen to have a repo to demonstrate how you put all these together? I'd love to learn. Thanks.
from react.
Unfortunately this is not for a public repository. I forgot to mention I was using nextjs. So <Head>
comes from next-head
.
from react.
Related Issues (20)
- Duplicate canvas when running in vite dev HOT 5
- TypeError: p5.loadSound is not a function HOT 4
- P5-wrapper size HOT 5
- Stop rerender of p5 component when redux variables update HOT 3
- Latest commits not in the npm registry HOT 5
- Issue building with Vite 5 HOT 16
- npm ERR! Usage Error: This project is configured to use npm HOT 2
- windowResized() not firing HOT 4
- Error in nextjs HOT 7
- Change p5 dependency version to minimum 1.4.1 HOT 9
- Examples directory doesn't exist, link broken on README HOT 3
- Module parse failed: Identifier 'XX' has already been declared (7762:41) HOT 3
- Is this package supported in React Native? HOT 1
- How to access custom props using abstracted updateWithProps
- Custom updaters as props for use in abstracted methods
- Missing typings for `ReactP5WrapperGuard` in 5.0.0-rc.0 HOT 2
- npm package for version 4.4.1 is empty HOT 3
- It creates new canvas once state is changed HOT 4
- How can I use @P5-wrapper/react in react native HOT 1
- drawingContext is not definied HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.