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

How to load plugins with this? #62

Closed
rchrd2 opened this issue Nov 21, 2020 · 5 comments
Closed

How to load plugins with this? #62

rchrd2 opened this issue Nov 21, 2020 · 5 comments

Comments

@rchrd2
Copy link

rchrd2 commented Nov 21, 2020

Is there a way to load p5 plugins using this wrapper?

@vennsoh
Copy link

vennsoh commented Nov 21, 2020

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

@jamesrweb
Copy link
Collaborator

@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!

@rchrd2
Copy link
Author

rchrd2 commented Nov 25, 2020

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.

@vennsoh
Copy link

vennsoh commented Nov 25, 2020

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.

@rchrd2
Copy link
Author

rchrd2 commented Nov 26, 2020

Unfortunately this is not for a public repository. I forgot to mention I was using nextjs. So <Head> comes from next-head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants