素朴な質問かもしれませんが、Processing.js にデストラクタはありますか? 通常の Processing は Java ベースなのでデストラクタがないことは知っていますが、Processing.js が同じように実行されるかどうかはわかりません。
ここにあるので、必要に応じてデストラクタを作成したいクラスを次に示します。
// Obstacle Class
class Obstacle {
float r,g,b;
float x, y, w, h;
float speed;
Obstacle(float x_pos, float y_pos, float width, float height, float sp) {
// Initialize Color
r = random(255);
g = random(255);
b = random(255);
// Initial Size
w = width;
h = height;
// Initial Position
x = x_pos;
y = y_pos;
// Initialize Speed
speed = sp;
}
void update() {
y += speed;
}
void draw() {
fill(r,g,b);
rect(x,y,w,h);
}
}