-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
Choosing which canvas to use with the wasm-experimental
feature
#930
Comments
Quick question, how did you get Nannou to add a canvas to the end of a page? Just by compiling it to WASM and then loading it from JS? |
Yes, I reckon I used this template template. |
@paolobettelini JulianCataldo/astro-nannou-starter solves this by embedding the nannou app in an iframe, like this: <iframe src="./nannou-embed" /> nannou-embed: <script>
await import("../../crates/my-app/pkg/nannou_web_test.js").then(
async ({ default: nannou }) => {
await nannou().then((s: any) => {
s.main_web();
});
}
);
</script> |
Yes, for now I'm also embedding them in an iframe but it isn't really a clean solution and I would like to directly interact with multiple nannou objects on the same page (like: don't render if not visible, send a signal of some kind). Those are features I can''t quite get yet. Thank you that repository I will check it out |
Hello,
I'm compiling
nannou
towasm32
to draw onto a canvas.I noticed that the package always adds a new canvas at the end of the page (as far as I understand it), but I would like to draw wherever I want.
I did achieve this but I had to modify the
nannou
source, and I think it should be a feature.window.rs
Now the canvas will clearly be placed into a
<div id="container1"></div>
.Note that the program must be called after the document has fully loaded.
Thanks a lot
The text was updated successfully, but these errors were encountered: