往期知识点整理
介绍
本示例介绍使用bindContentCover、transition、animateTo实现一镜到底转场动画,常用于首页搜索框点击进入搜索页场景。
效果图预览
使用说明
- 点击首页搜索框跳转到搜索页面显式一镜到底转场动画
实现思路
通过点击首页搜索框改变bindContentCover全屏模态转场中的isSearchPageShow参数控制页面是否显示,同时将modalTransition设置为NONE关闭全屏模态转场的动画,使用transition和animateTo实现首页到搜索页面的转场动画通过bindContentCover全屏模态转场衔接动画。
通过geometryTransition同时绑定首页和搜索页面的search框实现丝滑的上下文传承过渡,达到一镜到底的效果。
- 通过bindContentCover全屏模态转场实现对搜索页面显示的控制。
Column() {
Column() {
Search({
placeholder: $r('app.string.search_placeholder') })
.focusOnTouch(false)
.focusable(false)
.enableKeyboardOnFocus(false)
.backgroundColor('#E7E9E8')
.width(this.searchWidth)
.height(40)
.borderRadius($r('app.string.main_page_top_borderRadius'))
.onClick(() => {
this.onSearchClicked()
})
.geometryTransition(this.geometryId, {
follow