Vijay

10月16日

关于Scroll

软件使用

为何设置了scroll,card总是会回弹到原来的位置?

scroll = new ScrollComponent
    scrollHorizontal: false
    size: 330
    x: Align.center

scroll.content.props = 
    size: 50

card = new Layer
    backgroundColor: "yellow"
    size: 50
    parent: scroll.content

layerA = new Layer
    x: 100
    size: 50

# Modulate the scrolling distance 
scroll.onMove ->
    y = Utils.modulate(scroll.scrollY, [0,100], [0,10],true)
    layerA.y = y