Mein Ziel ist es, einen Fähigkeitsbaum zu erstellen, der jeweils einen Abschnitt anzeigt. Wenn Sie auf einen klicken, gelangen Sie zum nächsten Zweig.
Hier ist mein Code:
//var[
var branchLocation = function() {
this.x=0;
this.y=0;
this.rad=0;
this.diam=0;
this.r1=0;
this.g1=0;
this.b1=0;
this.r2=0;
this.g2=0;
this.b2=0;
};
var textWidthValue;
var circleDiameter;
var circleRadius;
var circleX;
var circleY;
//]
function branch(text1, x1, y1,r1,g1,b1,r2,g2,b2) {
//vars[
var textWidthValue = textWidth(text1);
var circleDiameter = max(50, textWidthValue + 40);
var circleRadius = circleDiameter / 2;
var circleX = x1;
var circleY = (3 / 5) * height - circleRadius;
branchLocation.push(branchLocation.x=x1);
branchLocation.push(branchLocation.y=y1);
branchLocation.push(branchLocation.diam=circleDiameter);
branchLocation.push(branchLocation.rad=circleRadius);
branchLocation.push(branchLocation.r1=r1);
branchLocation.push(branchLocation.g1=g1);
branchLocation.push(branchLocation.b1=b1);
branchLocation.push(branchLocation.r2=r2);
branchLocation.push(branchLocation.g2=g2);
branchLocation.push(branchLocation.b2=b2);
//]
line(x1, y1, x1, circleY);
fill(r1, g1, b1);
ellipse(circleX, circleY, circleDiameter, circleDiameter);
fill(r2, g2, b2);
textAlign(CENTER, CENTER);
text(text1, circleX, circleY);
}//to use bob put the text,rgb code of the circle, and rgb code of the text
fill(201, 50, 198);
// doesn't do anything. it is for rgb codes for calls of branch
branch("wild horses are beautiful", 184, 659,201, 50, 198,0);
branch("", 455, 630,18, 13, 179);
mouseClicked = function() {
if (mouseX>x-branchLocation.rad()){}// here is my error
};
Mein Fehler ist:
Wollten Sie rot statt rad eingeben? Falls Sie es vergessen haben, können Sie es wie red(color) | verwenden ProcessingJS
Können Sie helfen?
Mein Code in der Khan Academy ist auf dieser Webseite
Mein Ziel ist es, einen Fähigkeitsbaum zu erstellen, der jeweils einen Abschnitt anzeigt. Wenn Sie auf einen klicken, gelangen Sie zum nächsten Zweig. Hier ist mein Code: [code]//var[ var branchLocation = function() { this.x=0; this.y=0; this.rad=0; this.diam=0; this.r1=0; this.g1=0; this.b1=0; this.r2=0; this.g2=0; this.b2=0; }; var textWidthValue; var circleDiameter; var circleRadius; var circleX; var circleY; //] function branch(text1, x1, y1,r1,g1,b1,r2,g2,b2) { //vars[ var textWidthValue = textWidth(text1); var circleDiameter = max(50, textWidthValue + 40); var circleRadius = circleDiameter / 2; var circleX = x1; var circleY = (3 / 5) * height - circleRadius; branchLocation.push(branchLocation.x=x1); branchLocation.push(branchLocation.y=y1); branchLocation.push(branchLocation.diam=circleDiameter); branchLocation.push(branchLocation.rad=circleRadius); branchLocation.push(branchLocation.r1=r1); branchLocation.push(branchLocation.g1=g1); branchLocation.push(branchLocation.b1=b1); branchLocation.push(branchLocation.r2=r2); branchLocation.push(branchLocation.g2=g2); branchLocation.push(branchLocation.b2=b2); //]
fill(r2, g2, b2); textAlign(CENTER, CENTER); text(text1, circleX, circleY); }//to use bob put the text,rgb code of the circle, and rgb code of the text fill(201, 50, 198); // doesn't do anything. it is for rgb codes for calls of branch
mouseClicked = function() { if (mouseX>x-branchLocation.rad()){}// here is my error }; [/code] Mein Fehler ist: Wollten Sie rot statt rad eingeben? Falls Sie es vergessen haben, können Sie es wie red(color) | verwenden ProcessingJS Können Sie helfen? Mein Code in der Khan Academy ist auf dieser Webseite
Mein Ziel ist es, einen Fertigkeitsbaum zu erstellen, der jeweils einen Abschnitt anzeigt und wenn man auf einen klickt, geht es zum nächsten Zweig.
Ich weiß allerdings nicht, wie ich ihn verwenden...
Bitte verzeihen Sie meinen Code und konzentrieren Sie sich nur auf die Frage hier:
Wir wissen, dass das private Feld nicht vererbt wird und wenn ich in Zeile 2 ein Objekt erstelle, wird das Objekt...
Ich versuche eine Funktion zu optimieren, die eine sehr große Datei Zeile für Zeile verarbeitet. Ich habe einige Beispiele gesehen, in denen das Schlüsselwort yield verwendet wurde, aber ich verstehe...