2022年7月28日解決済み

-(this.w / 2) の意味が分かりません

ユーザー
update() {
      const rect = this.canvas.getBoundingClientRect();
      this.x = this.mouseX - rect.left - (this.w / 2);

上記の箇所について質問です。

this.x = this.mouseX - rect.left - (this.w / 2);

この箇所の意味、特に this.w/2 をする所がよく分かりません。

計算の仕組みを教えていただけますと助かります。

スタッフ

この回答を見るにはプレミアムプランへの登録が必要です

プレミアムプランとは?