I’m trying to keep an object pinned without using the “Pin to Browser” feature. To do that, I’m trying to move my target by the amount the window is scrolled (just in the opposite direction).
When I do this, though, my target moves much further than I’d expect. When I set up some variables to trace this I’m seeing a scroll of 95 pixels will move my target 122 pixels (for example). I feel like I’m missing something fundamental about how Window.scrollY works?
The [[Window.ScrollY]] value would depend on the scroll intensity, so some mice and trackpads might be more sensitive than others and may not get you consistent results. Scrolling your file using my mouse showed a scroll value of 120, for example, while scrolling using my trackpad showed lesser values.
If you wanted the red ball to stay pinned regardless of window scroll, you could use the “Move to” interaction rather than the “Move by”. Using “Move by” would continuously move your red ball further down or up on the page, while using “Move to” will move it to the y value of the window scroll. You could further customize this to keep your red ball in the top, middle, or bottom of the window by editing the Move interaction to add or subtract a few pixels.
I’ve edited your file to demonstrate this, please let me know if you have any questions or I misunderstood.
TIL scroll inputs are highly variable. I would have thought they’d at least be consistent in how they handle up and down in the same device, but evidently not for my mouse.
The “To” based solution you demonstrated should get me where I need to go. Much appreciated!