UIPageLayout
UIPageLayout : UIGridStyleLayout
Overview
A layout that treats each sibling UI element as a page, showing one page at a time and switching between pages.
Each page is placed side by side along the FillDirection, spaced apart by the size of the parent UI area, and the current page is displayed to fit the parent UI area. The order of pages is determined by SortOrder, and you can move to other pages with the JumpTo, JumpToIndex, Next, and Previous functions.
UIPageLayout can be controlled only in client environment.
Properties
Animated
boolean
Specifies whether to play an animation when switching pages.
If true, an animation that moves the page plays according to the TweenTime, EasingStyle, and EasingDirection settings; if false, it switches to the target page immediately. The default is true.
Code Samples
Circular
boolean
Specifies whether page navigation wraps around at the beginning and end.
If true, calling Next on the last page moves to the first page, and calling Previous on the first page moves to the last page. If false, no further movement occurs in that direction from the end pages. The default is false.
Code Samples
CurrentPage
GuiObject
A read-only property that returns the currently displayed page (UI element).
It is nil if there are no pages, and if the current page becomes invalid, for example by being removed, it is reassigned to the first page. When a page transition starts, this value changes to the target page immediately, before the animation finishes.
Code Samples
EasingDirection
Enum.EasingDirection
Specifies the easing direction applied to the page transition animation.
It applies only when Animated is true. The default is Out.
Code Samples
EasingStyle
Enum.EasingStyle
Specifies the easing style applied to the page transition animation.
It applies only when Animated is true. The default is Back.
Code Samples
Padding
UDim
Specifies the spacing between pages.
Scale is a ratio of the size of the parent UI area along the FillDirection, and Offset is a value in pixels. The default is UDim.new(0, 0).
Code Samples
ScrollWheelInputEnabled
boolean
Specifies whether pages can be switched with the mouse wheel.
If true, scrolling the mouse wheel down over the page area moves to the next page, and scrolling it up moves to the previous page, one page at a time. The default is true.
Code Samples
TouchInputEnabled
boolean
Specifies whether pages can be switched with touch swipes.
If true, swiping along the FillDirection in the page area moves one page at a time. A page switch occurs only if, at the moment the finger is lifted, the touch has moved at least 48 pixels along the FillDirection and that distance is greater than the movement along the cross axis; taps and drags along the cross axis do not switch pages. The default is true.
Code Samples
TweenTime
number
Specifies the duration of the page transition animation in seconds.
The minimum value is 0.01, and the default is 1.
Code Samples
Methods
JumpTo
Moves to the specified page.
Page must be one of the pages (sibling UI elements) arranged by this layout. If it is not, or if it is already the current page, nothing happens.
When the move starts, the PageLeave event fires for the previous page, and when the transition completes, the PageEnter event and the Stopped event fire in that order.
Parameters
Instance Page
The target page (UI element) to move to.
Return
void
Code Samples
JumpToIndex
Moves to the page at the specified index.
The index starts at 0, and values outside the page count (including negative values) are treated as the page corresponding to the remainder after dividing by the page count. If the target is already the current page, nothing happens.
The order in which events fire is the same as JumpTo.
Parameters
number Index
The index of the page to move to. The first page is 0.
Return
void
Code Samples
Next
Moves to the page after the current page.
If the current page is the last page, it moves to the first page when Circular is true, and does nothing when it is false.
Parameters
Return
void
Code Samples
Previous
Moves to the page before the current page.
If the current page is the first page, it moves to the last page when Circular is true, and does nothing when it is false.
Parameters
Return
void
Code Samples
Events
PageEnter
An event that fires when a page transition completes and a new page becomes the current page.
If Animated is false, it fires immediately when a page navigation function is called.
Parameters
Instance page
The UI element that has newly become the current page.
Code Samples
PageLeave
An event that fires when a page transition starts and the existing page stops being the current page.
Parameters
Instance page
The UI element that is no longer the current page.
Code Samples
Stopped
An event that fires when a page transition completes.
It fires immediately after the PageEnter event, and if Animated is false, it fires immediately when a page navigation function is called.
Parameters
Instance currentPage
The current page UI element at the time the transition completes.
Code Samples
Last updated