How do I include p5-dom when importing from npm module/instance mode?

The instructions for including p5 libraries just says to include them in the head file.

However, I’m using it instance mode, for use with react, like:

    componentDidMount() {
        import("p5").then((p5) => {
            this.canvasPaint = new p5.default(sketch, this.refPaint.current);
            this.canvasPaint.doUpdate(
                this.props.controlPackage,
                this.props.statePackage,
                this.props.algorithms[this.props.selectedAlgo]
            );
        });
    }

I now want to add p5-dom so I can do video capture stuff. Is this possible?

There is this github issue - but it doesn’t really answer the question.

1 Like

This article could be relevant, follow the links for p5.dom and p5.sound and see if it helps: https://medium.com/front-end-weekly/the-building-of-threadd-react-three-js-p5-js-fc988e687686

Kf

2 Likes