Download

How To Scroll (Left/Right) Repeatedly

I’m trying to put together a BP logic that will scroll from left to right or right to left repeatedly. I’ve been searching around to see if this can be achieved with the UMG scrollbox but I’ve not had much luck. I want to create something similar to the DEMO example shown at the link below.

http://www.smoothdivscroll.com/index.html#quickdemo

Initially, I was thinking of using a horizontal box with some panels, each given an index. Then using an integer variable to set an index that will call each panel as I scroll left or right and set a position based on a positive or negative value. But that doesn’t give the kind of effect I want. Anyone got any ideas or tricks to share? The main thing is to be able to scroll repeatedly left or right when a button is held down without stopping.

This can actually be achieved with a scrollbox, you just have to set it to be horizontal. Then on tick you can have a gate that checks if your button is held, then call a function like this:

For now there is no way to “get” the scroll offset of a scrollbox, but I submitted a pull request a while back that should make it into 4.8. I’m not sure if it’s there now in the preview since I develop on the stable release version. To wrk around this, you can create a new variable (I called it Credits Scroll Offset since this is used for credits) and initialise it to 0 (far left). When this function is called, the credits scroll offset variable = itself + another credits scroll rate variable * delta time. Then I plug the result of that into “set scroll offset” on the scrollbox. It automatically scrolls.

Keep in mind it’s not the smoothest solution necessarily. It looks a little jerky at slow speeds. Just mess with the rate until you get a acceptable tradeoff between jerkiness and speed.

After some tinkering around I’ve discovered that what I’m trying to create can only be done by adding menu widgets to a canvas and playing around with the SetPosition node and calling some animations etc.