Having the dynamically changed mouse position I'm trying to convert it to width pixels, making it 0px if the mouse is at the bottom of the screen and 100px if the mouse is at the top frame of the screen, how is it possible in js? Probably I would need a regular converting expression. Maybe I also would need an if statement?
let posY = 0.23 // received from the outer function
const el = document.querySelector(".el")
el.style.width = (posY*2 ...) + 'px', //trying to write this line, make it wider if posY > 0, more narrow if posY < 0 relatively
I imagine it would be something like this:
Try to move around your mouse above the snippet, up and down. It should show you the translated size in pixel according to the mouse position on the viewport.