Class: PageViewComponent
Swipe-between-pages (Cocos's PageView) on top of a ScrollView on the same entity: the pages are the ScrollView content's children. A release snaps to a page — the next one when the drag went past scrollThreshold of a page or flicked faster than flickSpeed, else back. A page smaller than the view is centred in it, so a carousel with spacing works too.
Writing currentPage scrolls there. indicator is an entity whose children are the dots, in page order: the current one gets activeColor, the rest color (their Sprite tint). EntityEvent.PageChanged on the host (payload: the page index) once it settles on a new page.
Extends
Constructors
Constructor
ts
new PageViewComponent(): PageViewComponent;Returns
PageViewComponent
Inherited from
Properties
| Property | Modifier | Type | Default value | Inherited from |
|---|---|---|---|---|
activeColor | public | number | undefined | - |
color | public | number | undefined | - |
currentPage | public | number | undefined | - |
dirty | public | boolean | true | Component.dirty |
enabled | public | boolean | true | Component.enabled |
flickSpeed | public | number | undefined | - |
indicator | public | number | null | undefined | - |
scrollThreshold | public | number | undefined | - |
turnDuration | public | number | undefined | - |
Accessors
pageCount
Get Signature
ts
get pageCount(): number;Returns
number
Methods
NextPage()
ts
NextPage(): void;Returns
void
PreviousPage()
ts
PreviousPage(): void;Returns
void
SetIndicator()
ts
SetIndicator(target): void;Parameters
| Parameter | Type |
|---|---|
target | number | Entity | null |
Returns
void