Relative CanvasPosition?

I am trying to make a Rolling Gui for pets (Similar concept for lootboxes and spins). I’m using a ScrollingFrame and tweening its CanvasPosition property to a specific number to simulate a spin.

Problem: When CanvasPosition is set to (100, 0) for example, the position of the canvas never stays at one point because it is always relative to the current ScrollingFrame size. But I want the CanvasPosition to always remain in one position.

Example:
The Green Pet is supposed to be rolled by the player. But when the player has a slightly different screen size it will appear as if the player has rolled a different pet altough the CanvasPosition stays the same in both cases.

I want that the pet in the green area will ALWAYS be drawn by the player, independent from the players screen size or the size of the ScrollingFrame.

Can anybody help me with this?

2 Likes

CanvasPosition is in units of pixels.

You can convert units of pixels to a universal size of percent of size (called “scale”) by dividing the pixels by the canvas pixel size.

You can get the size of the scrolling frame canvas using ScrollingFrame.AbsoluteCanvasSize.

2 Likes

Ahhh thanks, so if I want to move it to 90% lets say I set the CanvasPosition to AbsoluteCanvasSize.X * 0.9 right?

1 Like

Yep!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.