I have a question:
Am I getting x, y coordinates correctly?
How to do if x, y are equal (0.5, 0.5), then the center of the picture will be placed in the upper right corner of the blue area?
If scale = 1, the picture will occupy the entire surface of the blue area.
If the picture is square and scale = 1, then the picture will occupy the height of the entire blue area, and the width will crawl out a bit. Accordingly, reducing the scale of the picture will decrease on the blue area, if scale = 0 then the image will not be visible at all, and if 0.5 then the picture = half of the blue area!
How to do this with scale?
So I sketched my example on which I stopped, and nothing else comes to mind:
<body> <div id="coords"> </div> <div id="scale"> </div> <div id="block"> <div id="joystick"> <div id="mover" style=" background: url(http://img.youtube.com/vi/JMJXvsCLu6s/mqdefault.jpg) 100% 100% no-repeat; background-size:100% 100%;"></div> </div> </div> </body> Thank!