Как оформить изображение на холсте - PullRequest
0 голосов
/ 01 мая 2020

Как получить свойства стиля в this.image?

export default class ball {
  constructor(game) {
    this.image = document.getElementById("ball");
    this.game = game;
    this.gameWidth = game.gameWidth;
    this.gameHeight = game.gameHeight;
    this.speed = {
      x: 4,
      y: 4
    };
    this.size = 30;
    this.position = {
      x: game.gameWidth / 2 - this.size / 2,
      y: game.gameHeight / 8,
    };
  }
  paint(ctx) {
    ctx.drawImage(this.image, this.position.x, this.position.y, this.size, this.size);
  }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...