diff --git a/zh-cn/application-dev/reference/arkui-js/figures/transition.gif b/zh-cn/application-dev/reference/arkui-js/figures/transition.gif new file mode 100644 index 0000000000000000000000000000000000000000..00104ac518f8a058dfc38d3087995b37b34d4d6a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js/figures/transition.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md b/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md index bbf7ca807f64b5a8206a8f865dd8dcdda7bf6b06..fe27955501c1f99f5e500a9eb8e23f73561b8a95 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-common-transition.md @@ -48,10 +48,8 @@ PageA跳转到PageB,跳转的共享元素为image, shareid为“shareImage
-
- - Click on picture to Jump to ths details -
+ + Click on picture to Jump to ths details
@@ -237,3 +235,145 @@ export default { b. back场景下:退出页面栈的Page2.js应用transition-enter描述的动画配置,并进行倒播;从页面栈第二位置进入栈顶位置的Page1.js应用transition-exit描述的动画配置,并进行倒播。 ![zh-cn_image_0000001238184345](figures/zh-cn_image_0000001238184345.png) + +### 示例 + +Page1有一个不透明盒子,点击盒子会跳转到Page2,当点击Page2中的盒子,会回退到Page1页面。 + +1. Page1 + + ``` + +
+ index +
+
+ ``` + + ``` + + import router from '@system.router'; + export default { + data: { + + }, + jump() { + router.push({ + uri:'pages/transition2/transition2' + }) + } + } + ``` + + ``` + + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + } + .move_page { + width: 100px; + height: 100px; + background-color: #72d3fa; + transition-enter: go_page; + transition-exit: exit_page; + transition-duration: 5s; + transition-timing-function: friction; + } + + @keyframes go_page { + from { + opacity: 0; + transform: translate(0px) rotate(60deg) scale(1.0); + } + + to { + opacity: 1; + transform: translate(100px) rotate(360deg) scale(1.0); + } + } + @keyframes exit_page { + from { + opacity: 1; + transform: translate(200px) rotate(60deg) scale(2); + } + + to { + opacity: 0; + transform: translate(200px) rotate(360deg) scale(2); + } + } + ``` + + + +2. Page2 + + ``` + +
+ transition +
+
+ import router from '@system.router'; + export default { + data: { + + }, + jumpBack() { + router.back() + } + } + ``` + + ``` + + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; + } + + .move_page { + width: 100px; + height: 100px; + background-color: #f172fa; + transition-enter: go_page; + transition-exit: exit_page; + transition-duration: 5s; + transition-timing-function: ease; + } + + @keyframes go_page { + from { + opacity: 0; + transform:translate(100px) rotate(0deg) scale(1.0); + } + to { + opacity: 1; + transform:translate(100px) rotate(180deg) scale(2.0); + } + } + + @keyframes exit_page { + from { + opacity: 1; + transform: translate(0px) rotate(60deg) scale(1); + } + to { + opacity: 0; + transform: translate(0px) rotate(360deg) scale(1); + } + } + ``` + + ![transition](figures\transition.gif)