2017-09-26 12 views
0

스크롤 구성 요소와 수평 스크롤 .FramerJS - 나는 스크롤 영역을 생성하고 난 현재 스크롤 영역이있는 이미지 아래에 스크롤 (링크 된 이미지의 파란색 스크롤)</p> <p>코드를 추가하려고

scroll = new ScrollComponent 
opacity: 1.00 
shadowBlur: 0 
scroll.size = screen 
Info.parent = scroll.content 
scroll.scrollVertical = false 

Scroll

+0

그것은 어떤 문제가 명확하지 않거나 당신이 발생한 문제를 해결합니다. – Steven

답변

0

나는 당신이 바로, 스크롤로 이동하고 얼마나 사용자를 따라 스크롤있다 보여 스크롤바를 만들려고 노력하는 것 같아요? 다음은이 작업을 수행하는 방법을 몇 가지 코드입니다 :

scrollbar.parent = scroll 
# First make the width of the scrollbar relative to the size of the content. 
scrollbar.width = (scroll.width/scroll.content.width) * scroll.width 
# When the scroll is moved 
scroll.onMove -> 
    # Calculate the width that we should scroll over 
    width = scroll.content.width - scroll.width 
    # Calculate the percentage that has currently been scrolled 
    percentage = scroll.scrollX/width 
    # Calculate how much space there for the scrollbar to move in 
    freeSpace = scroll.width - scrollbar.width 
    # Set the position of the scrollbar relative to the free space and the percentage scrolled 
    scrollbar.x = freeSpace * percentage 

전체 예제는 여기에 있습니다 : https://framer.cloud/QtcLD