Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Function can't be displayed in second canvas within p5.js

I created two separate canvases with p5.js by creating a new instance (see line 58 in my javascript file). Then I inserted a function called "firstAnimation" that will be displayed in one of the canvases.

Run the code here –> https://editor.p5js.org/MaximilianFreitag/sketches/fP46XAHnP

In line 45 of my javascript file p5.js is telling me that my function "secondAnimation" does not exist. So I can not output another animation in this canvas

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In line 49 I can still draw a circle inside the second canvas with sketch.circle(100,100,100).

How can I display my second function in the second canvas so that I have two animations?

enter image description here

I can only add a simple circle

>Solution :

You nead to specify where to draw a line. in second function just add myp5.line and just run function secondAnimation() without sketch.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading