Задать вопрос
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();
  • Вопрос задан
  • 77 просмотров
Подписаться 1 Простой 1 комментарий
Помогут разобраться в теме Все курсы
  • Нетология
    Fullstack-разработчик на Python + нейросети
    20 месяцев
    Далее
  • Skillfactory
    Профессия Веб-разработчик
    12 месяцев
    Далее
  • Яндекс Практикум
    Фронтенд-разработчик
    10 месяцев
    Далее
Решения вопроса 1
24 строка let $_animated_background = document.getEmentById('animated-background');
Ement)))
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

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

Похожие вопросы