Моя цель — создать дерево навыков, в котором одновременно отображается по одному разделу, и если вы щелкнете по одному из них, оно перейдет к следующей ветке.
Вот мой код:
//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
};
Моя ошибка:
Вы хотели ввести красный вместо рад? Если вы забыли, вы можете использовать его как red(color) | ProcessingJS
Можете ли вы помочь?
мой код в Академии Хана находится на этой веб-странице
Моя цель — создать дерево навыков, в котором одновременно отображается по одному разделу, и если вы щелкнете по одному из них, оно перейдет к следующей ветке. Вот мой код: [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] Моя ошибка: Вы хотели ввести красный вместо рад? Если вы забыли, вы можете использовать его как red(color) | ProcessingJS Можете ли вы помочь? мой код в Академии Хана находится на этой веб-странице