page.snapToNextPage(direction, animate, animationOptions)

Snap to a specific the next page. Takes three arguments: direction, animate (true or false) and animation options. By default, the direction is set to "right" and animate is true.
译:捕捉到一个特定的下一页。需要三个参数:方向,动画(“真”或“假”)和动画选项。默认情况下,方向是设置为“右”的“”和动画是“真”的“”。

page = new PageComponent
    width: Screen.width
    height: Screen.height

pageOne = new Layer
    width: page.width
    height: page.height
    parent: page.content
    backgroundColor: "#28affa"

pageTwo = new Layer
    width: page.width
    height: page.height
    backgroundColor: "#90D7FF"

page.addPage(pageTwo, "right")

# Automatically scroll to pageTwo 
page.snapToNextPage()

This allows you to snap to pages in any direction. For example, we can start on the first page by snapping to it without animating, and then animate back to the first page.
译:这允许你在任何方向上捕捉到页面。例如,我们可以从第一页开始通过捕捉它没有动画,然后动画回到第一页。

# Start at page two by default 
page.snapToPage(pageTwo, false)

# Scroll back to the page at its left, which is pageOne 
page.snapToNextPage("left", true)

results matching ""

    No results matching ""