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();