1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Declare the jump method. 18 * @since 7 19 */ 20declare enum RouteType { 21 /** 22 * The page is not redirected. 23 * @since 7 24 */ 25 None, 26 /** 27 * Go to the next page. 28 * @since 7 29 */ 30 Push, 31 /** 32 * Redirect to a specified page. 33 * @since 7 34 */ 35 Pop, 36} 37 38/** 39 * Declare the sliding effect of transition. 40 * @since 7 41 */ 42declare enum SlideEffect { 43 /** 44 * Swipe left. 45 * @since 7 46 */ 47 Left, 48 49 /** 50 * Swipe right. 51 * @since 7 52 */ 53 Right, 54 55 /** 56 * Swipe top. 57 * @since 7 58 */ 59 Top, 60 61 /** 62 * Swipe bottom. 63 * @since 7 64 */ 65 Bottom, 66} 67 68/** 69 * Provides interfaces for common transitions. 70 * @since 7 71 */ 72declare class CommonTransition<T> { 73 /** 74 * Called when a transition method is required. 75 * @since 7 76 */ 77 constructor(); 78 /** 79 * Called when the slide in effect of the transition is set. 80 * @since 7 81 */ 82 slide(value: SlideEffect): T; 83 84 /** 85 * Called when the translation effect of page transition is set. 86 * @since 7 87 */ 88 translate(value: { x?: number | string; y?: number | string; z?: number | string }): T; 89 90 /** 91 * Called when setting the zoom effect of page transition. 92 * @since 7 93 */ 94 scale(value: { x?: number; y?: number; z?: number; centerX?: number | string; centerY?: number | string }): T; 95 96 /** 97 * Called when the transparency value of the starting point of entry or the ending point of exit is set. 98 * @since 7 99 */ 100 opacity(value: number): T; 101} 102 103/** 104 * Provides an interface for page rotation mode. 105 * @since 7 106 */ 107interface PageTransitionEnterInterface extends CommonTransition<PageTransitionEnterInterface> { 108 /** 109 * Called when page Jump animation is used. 110 * @since 7 111 */ 112 (value: { type?: RouteType; duration?: number; curve?: Curve | string; delay?: number }): PageTransitionEnterInterface; 113 114 /** 115 * Called when the incoming parameter is the normalized progress of the current incoming animation. 116 * @since 7 117 */ 118 onEnter(event: (type?: RouteType, progress?: number) => void): PageTransitionEnterInterface; 119} 120 121/** 122 * Provide an interface to exit the transition. 123 * @since 7 124 */ 125interface PageTransitionExitInterface extends CommonTransition<PageTransitionExitInterface> { 126 /** 127 * Called when the transition is delayed. 128 * @since 7 129 */ 130 (value: { type?: RouteType; duration?: number; curve?: Curve | string; delay?: number }): PageTransitionExitInterface; 131 132 /** 133 * Called when the input parameter is the normalized progress of the current exit animation. 134 * @since 7 135 */ 136 onExit(event: (type?: RouteType, progress?: number) => void): PageTransitionExitInterface; 137} 138 139/** 140 * Defines PageTransitionEnter Component. 141 * @since 7 142 */ 143declare const PageTransitionEnter: PageTransitionEnterInterface; 144 145/** 146 * Defines PageTransitionExit Component. 147 * @since 7 148 */ 149declare const PageTransitionExit: PageTransitionExitInterface; 150