1
class Attractor {
PVector location;
float mass;
Attractor() {
location = new PVector(width/2, height/2);
mass = 5;
}
void display() {
stroke(0);
fill(125);
ellipse(location.x, location.y, mass*10, mass*10);
}
}
Attractor a = new Attractor();
void setup()
{
size(640, 360);
}
void draw()
{
background(255);
a.display();
}
ボールの位置は、アトラクタオブジェクトである、すなわち、P-VECTOR(幅/ 2、高さ/ 2)です。
私はコードを実行すると、中央になく、ウィンドウの右側と上に表示されます。
これは何語ですか? – Neal
@ニール処理。それはタグの中にあります。 –