Including generative art

Hey ! I need to create a portfolio for studies, and I want to add some generative artworks I made using Processing (javascript). For it to be easier to use, I translated my projects into p5.js, and simply wanted to add the p5.js library in public files on wix (contained in a .js file).
I did it, and exported all functions I needed into my homepage’s script, but the code isn’t loading (refer to the image I link). I’ve heard about Iframe… is it what I should use ?
I’m fairly new to coding so I may be completely out of logic but I’m trying to get it right.
Thank you sm, this project is really important for me, if anyone could help me it would be amazing !

Your screenshot doesn’t include the public file folder, so we can’t see if you did it right (I can’t even see the full import line).
Anyway, I don’t think you’ll be able to run this code in the Velo page code.

I’ve never used p5 but based on your module names it looks like you need access to the window and DOM, so maybe try doing it in a custom element .

Hey ! ty so much :slight_smile: so you mean I should get p5 library as a custom element or all my code ?

Okay I believe I actually understood how custom elements work, but I can’t afford the wix subscritption haha, ty anyway !

You may be able to do it in an iframe (embedded widget) if you get the library from cdn using <script src=“https://some-url.js”>
I can’t tell you for sure as I’m not familiar with this library. But you can read their docs.