绘制后是否可以更改 p5 文本元素的位置?

Is it possible to change the position of a p5 text element after it is drawn?

是否可以在绘制后更改 p5 文本元素的位置而不重新绘制整个 canvas?如果是这样,我将如何能够? 我试图让文本出现在设置为当前位置的玩家下方,但当他们移动时,我希望它能将其位置更改为玩家的位置。我有那个设置的事件,我只是不知道如何更改元素的位置。

不像有些库,比如fabric.js, graphical elements in p5.js are not persistent objects that can be moved or modified once they are drawn. Instead, everything in p5.js is drawn in immediate mode. So when you are drawing text you specify it's attributes at the time you draw it, using the Typography functions, and the text(). In order to "move" text you would clear the canvas, or re-paint the background (using clear() or background()分别,然后用不同的设置或参数重新绘制文字。