you don’t want to use scroll position, width or height dynamic variables as each time the elements are reloaded those values potentially change as the canvas is resized (even to the same size)

if you must use those values save them in a state on page load (downside is if the user scales the screen then the state values are fixed - although there’s a slim chance most users will do that)

doesn’t look like the image changes very much so I’d also evaluate whether you actually need to change the image on scroll or if you could achieve a similar result another way