在 FramerJS 中使用是真的吗——通过滑动来垂直滚动页面上的内容?例如: 1. 我在 Sketch 中有 2 个组和蒙版。2. 组被导入 FramerJS 3. 每个被 framer 包裹的组都添加了一个垂直滚动 4. 我可以将这些层与包裹组一起用于水平滑动页面吗?
是否可以通过水平滑动对页面上的内容进行垂直滚动?
有没有人有一个例子?:(
是的,这是可能的。您可以将 ScrollComponent 层包装在 PageComponent 中。以下是一些示例代码,可帮助您入门:
# This page component holds the horizontally aligned pages
pageComponent = new PageComponent
y: sketch.navigationBar.height
height: Screen.height - sketch.navigationBar.height
width: Screen.width
# The scroll direction is restricted to only allow for horizontal scrolling
scrollVertical: false
# The direction lock is enabled to only allow either horizontal or vertical scrolling
directionLock: true
for pageIndex in [0...3]
# A scroll component is created
scrollComponent = new ScrollComponent
size: pageComponent.size
x: pageIndex * pageComponent.width
contentInset: bottom: 40
# Only vertical scrolling is allowed and the direction is locked
scrollHorizontal: false
directionLock: true
这是来自 Framer JS 网站库中的 Medium 应用程序示例: