简体   繁体   中英

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

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?

在此处输入图像描述

I can only add a simple circle

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM