How to create infinite Scrolling Frame?

Hey Everyone, my Name Is Nehoray

Quick Question:
Is It possible to create infinite Scrolling Frame?

Thanks.

1 Like

I think that you need changing size when scroll frame ending

1 Like

Yes, if you set the canvas size to math.huge it will turn to infinite.

I wouldn’t approach this by setting the CanvasSize property to some outrageously large number. Instead you may want to implement your own pseudo-“ScrollingFrame”. But the specifics of the steps you would take depend on the situation you plan on using it for. If you have an idea in mind and want to share it, I could offer some advice and maybe even some pseudocode to get you started.

2 Likes

I want to create like twitter feed

I have knowledge in scripting but I don’t have the starting point

So first of all you would want to implement some sort of function for grabbing, the next ‘x’ items from the feed. Might look something like this:

function getFeedItems(player, startingPoint, count)
   --player - Which player should the feed be specific to? 
      --If all players see the same this argument is unnecessary
   --startingPoint - the starting point in the Feed so that you can grab the first 'count' items. Successive calls can then incremement the starting point
      --For example, {0, 50, 100, 150...}
   --count - How many FeedItems you would like to return (at maximum)

   --Do some work here either with DataStores or HTTPService to fetch feed results

   return {} --Some list containing the result feed items
end

You first call to the function listed above might look like:

  • getFeedItems(game.Players.LocalPlayer, 0, 50)

This would return the first 50 feed items. Then populate the custom scrolling frame with these result. You can then ‘detect’ when the player has scrolled far enough down to be close to the end of the current feed and fetch the next 50 results with the following line:

  • getFeedItems(game.Players.LocalPlayer, 50, 50)

Using this technique you can then “recycle” or delete feed items which are far off the current view frame. You might find it helpful to look at any classes which utilize the Pages object such as FriendPages for an idea of how fetching a range of results works.

3 Likes

yes, it is possible by setting canvas size to math.huge, but i wouldnt recommend doing this
if you want to create twitter-like feed, use something like auto-update canvas, so it isnt infinite and it loads contents of another feed section

1 Like

like @East98 said, i’d create a custom scrolling frame that would use a list layout to organize items, and make a function to add, load, and remove items from this custom scrolling frame. it’d work by loading in however many items you want to display by default, and put those into a normal frame, then when you scroll down it would change the top item to whatever the second item was and so on, and since the last item would be a dupe of the item right above it, because they all shifted up one place, you could load a freshly new item that was “below” the last one. this should simulate the effect of scrolling. (however this would not work well with smooth scrolling or mobile, it would have to be slightly different)

events needed:
Mouse.WheelForward,
Mouse.WheelBackward.

you can look at the mouse documentation here: