我似乎無法找到錯誤,但是當我刪除if語句它運行良好。代碼很短,所以應該很容易找到問題。processing.js意外的標識符在if()
int zw1;
int zw2;
int px = 100;
int py = 100;
int ppx = px + random(-20, 20);
int ppy = py + random(-20, 20);
int cx;
int cy;
int xrand = 50;
int yrand = 50;
int opacity = 49;
frameRate(30);
background(74, 71, 74);
int timetoclear = 0;
int x0 = 0;
int y0 = 0;
void setup() {
size(400, 400);
}
void draw() {
cx = px + random(-xrand, xrand);
cy = py + random(-xrand, xrand);
// fill(74, 72, 74,5);
// rect(-10,-10,1000,1000);
//cx = mouseX;
//cy = mouseY;
if (cx <= 0) {
cx = 0;
}
if (cx >= 400) {
cx = 400;
}
if (cy <= 0) {
cy = 0;
}
if (cy >= 640) {
cy = 640;
}
stroke(30 + random(-100, 100), 195 + random(-100, 100), 201, 60);
fill(30 + random(-100, 100), 195 + random(-100, 100), 201, 50);
triangle(ppx, ppy, px, py, cx, cy);
ppx = px;
ppy = py;
px = cx;
py = cy;
}
拋出: 未捕獲的SyntaxError:意外的標識
請包括確切的錯誤信息。 – JosephGarrone
未捕獲的語法錯誤:意外的標識符 – Lauritz
JavaScript是怎麼回事? –