Framer動效15

今天照著framer官網(wǎng)的視頻做了一個Facebook的Group的動效。

我們首先來看動效的幾個點:

Group的信息可以上下查看

點擊Write進入發(fā)布頁面

點擊Cancle回到Group頁面


01 ?制作上下滑動的動效

這里我們使用scroll=ScrollComment.wrap( ),官方文檔對此命令的解釋是


將一個層放在一個新的scroll容器中,具體代碼如下:

sketch = Framer.Importer.load("imported/view-transition@1x")

scroll=ScrollComponent.wrap(sketch.group)

scroll.scrollHorizontal=false ?#禁止左右滑動,只允許上下滑動

scroll.contentInset=

? bottom:90 ? #限制離開底部的距離

scroll.on Events.Scroll,->

? if scroll.scrollY<=0 then? scroll.scrollY=0 ?#向下拉時,頂部不會被拉下來


02 ?進入發(fā)布頁

postLayer=new Layer

? width: Screen.width

? height: Screen.height

? image: sketch.post.image

? y: Screen.height

sketch.write.on Events.Click,->

? postLayer.animate

? properties:

? ?y:0

?curve: "spring(400,35,3)"

03 ?cancle回到Group界面

cancelButton=new Layer

subLayer:postLayer

x: 8

y: 30

width: 140

height: 100

backgroundColor:null

cancelButton.on Events.Click ,->

postLayer.animate

properties:

y: Screen.height

curve: "spring(400,35,3)"


最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容