Background-position.px

Like the title, I am struggling a bit whit updating dynamically the background position, of the background image… I researched a bit and background-position-y and x also exist but they don’t work dynamically with javascript, Can anyone help me =|
I need to be able to update it in an interval both x and y

myElement.style.backgroundPosition = "yPosition xPosition"; 

Hi Dan it comes undefined but I gave up on that it works for me if i format the background picture but, using your solution returns undefined for me =)

This might be a stupid question, but just to make sure, you didn’t use the literal myElement as the element right? I mean you did grab the element from the DOM and used it on that?

const BG = document.querySelector('#myIdOnTheBGElement');
BG.style.backgroundPosition = "yPosition xPosition";

https://www.w3schools.com/jsref/prop_style_backgroundposition.asp