dmc1989
@dmc1989

Почему background не двигается?

https://codepen.io/wasya1212/pen/PybxwX

В чем проблема?

class AnimatedBalckground {
  constructor(container) {
    this.container = container;
    this.position = {
      x: 0,
      y: 0
    };
  }
  
  getPosition() {
    return `${this.position.x}px ${this.position.y}px`;
  }
  
  startMove() {
    setInterval(() => {
      this.container.style.backgroundPosition = this.getPosition();
      
      this.position.x += 10;
      this.position.y += 10;
    }, 200);
  }
};

let $_animated_background = document.getEmentById('animated-background');

let animatedBackground = new AnimatedBackground($_animated_background);

animatedBackground.startMove();
  • Вопрос задан
  • 68 просмотров
Решения вопроса 1
24 строка let $_animated_background = document.getEmentById('animated-background');
Ement)))
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы