FAScrollSnapBehaviour Class
[RequireComponent(typeof(ScrollRect))]
public class FAScrollSnapBehaviour : IBeginDragHandler,
IEndDragHandler,
IDragHandler
This language is not supported or no code example is available.
Name | Description | |
---|---|---|
![]() |
DidInit |
Gets the initialization status of the FAScrollSnapBehaviour
|
![]() |
IsHorizontal |
Gets the scrolling orientation of the FAScrollSnapBehaviour
|
![]() |
IsLerping | Returns true when the Scroll View is moved true button, and the movement is still in action. |
![]() |
Items | List of all FAScrollSnapItem child items. |
![]() |
Velocity | Get the scroll view velocity (velocity != 0 only when scroll view is dragged, when button is clicked velocity == 0) |
Name | Description | |
---|---|---|
![]() |
InvokeScrollEvents() | |
![]() |
LerpToPage(int) |
Smoothly lerps the Scroll View to the page at the given index.
Can be called on button click. |
![]() |
OnBeginDrag(PointerEventData) | |
![]() |
OnDrag(PointerEventData) | |
![]() |
OnEndDrag(PointerEventData) | |
![]() |
SetScrollPosition(float) | |
![]() |
Setup() |
Setup can be called at any time to setup the behaviour.
Should be called on Start or when the number of items in the Scroll View changes. |
Name | Description | |
---|---|---|
![]() |
OnMouseDownEvent | |
![]() |
OnMouseUpEvent | |
![]() |
ScrollEndedEvent |
Occurs when scrolling has completely ended.
Useful for cleaning up effects and animations. |
![]() |
ScrollEvent |
Occurs when the ScrollRect is scrolled.
The passed Vector2 argument holds the Useful for doing animations on a single item and compare positions. |
![]() |
ScrollPercentageEvent |
Occurs when the ScrollRect is scrolled.
The passed float argument holds the normalized value of the scrolled percentage. 0f means first page is selected. 1f means last page is selected. Useful for doing animations on a group of items. |
![]() |
ScrollStartedEvent | Occurs when scrolling has started. |
![]() |
ScrollToPageEvent |
Occurs when the ScrollView locks on a page and scrolls to it.
Useful for doing animations after a page was found and selected. If buttons are used for navigation, this event occurs on Prev/Next button tap. If scrolling with FAScrollSnapBehaviour.snapToFirst set to true, this occurs as soon as the dragging end. If scrolling with FAScrollSnapBehaviour.snapToFirst set to false, this occurs after the scroll speed is slowed enough so it locks to a page. |
Name | Description | |
---|---|---|
![]() |
centerSelectedItem | |
![]() |
decelarationLimit | When decelarating freely, Gets or sets how slowed should the scrolling speed be before snapping. |
![]() |
decelerationRate | |
![]() |
fastSwipeThresholdDistance | Gets or sets threshold time for fast swipe in (unscaled) pixels. Default is 50. |
![]() |
fastSwipeThresholdTime | Gets or sets the threshold time for fast swipe in seconds. Default is 0.3f. |
![]() |
forceSize | Gets or sets if the this forces to resize the item according to one of the multipliers. See widthMultiplier and heightMultiplier/> |
![]() |
heightMultiplier |
Gets or sets how tall should one item be in relation to the ScrollRect Height.
1f means same height, 0.5f means half height. Works only if ScrollRect is vertical. |
![]() |
innerScrolls | If you have inner scroll views that scroll in the opposite direction of this ScrollSnapRect, you should add them here so the Drag Event is propagaded to this ScrollSnapRect. Should be set in inspector, otherwise please initialize the List. |
![]() |
nextButton | Button to go to the next page (optional) |
![]() |
onMouseDown | |
![]() |
onMouseUp | |
![]() |
onScrollEnded |
Occurs when scrolling has completely ended.
Useful for cleaning up effects and animations. |
![]() |
onScrollStarted | Occurs when scrolling has started. |
![]() |
onScrollToPage |
Occurs when the ScrollView locks on a page and scrolls to it.
Useful for doing animations after a page was found and selected. If buttons are used for navigation, this event occurs on Prev/Next button tap. If scrolling with snapToFirst set to true, this occurs as soon as the dragging end. If scrolling with snapToFirst set to false, this occurs after the scroll speed is slowed enough so it locks to a page. |
![]() |
onScrolled |
Occurs when the ScrollRect is scrolled.
The passed Vector2 argument holds the Useful for doing animations on a single item and compare positions. |
![]() |
onScrolledPercentage |
Occurs when the ScrollRect is scrolled.
The passed float argument holds the normalized value of the scrolled percentage. 0f means first page is selected. 1f means last page is selected. Useful for doing animations on a group of items. |
![]() |
prevButton | |
![]() |
snapToFirst | If true, will snap to the first item, if false, will decelarate freely then snap when decelarationLimit is reached. |
![]() |
startingPage | Gets or sets starting page index - starting from 0. Default is 0. Should be set before initialization |
![]() |
widthMultiplier |
Gets or sets how wide should one item be in relation to the ScrollRect Width.
1f means same width, 0.5f means half width. Works only if ScrollRect is horizontal. |