Type Function Library widget.* Revision 2017.3060 Keywords widget, scroll view, ScrollViewWidget, scrollToPosition See also object:scrollTo() widget.newScrollView() ScrollViewWidget
Makes a ScrollViewWidget scroll to a specific x or y position.
object:scrollToPosition( options )
This function takes a single argument, options
, which is a table that accepts the following parameters:
Number. The x position to scroll to. If you only want to scroll vertically, you should omit this parameter.
Number. The y position to scroll to. If you only want to scroll horizontally, you should omit this parameter.
Number. Time in milliseconds to scroll to the specified coordinate(s). For an instantaneous effect (no transition), set this to 0
. Default is 400
.
Function. An optional function that will be called when the scroll completes.
local function onScrollComplete() print( "Scroll complete!" ) end scrollView:scrollToPosition { x = 100, y = -100, time = 800, onComplete = onScrollComplete }