1# RemoteWindow 2 3**\<RemoteWindow>** is a component used to control the application window, providing the component animator and application window linkage animator during application startup and exit. 4 5> **NOTE** 6> 7> This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. 8> 9> The APIs provided by this component are system APIs. 10 11## Child Components 12 13Not supported 14 15## APIs 16 17RemoteWindow(target: WindowAnimationTarget) 18 19Creates a **\<RemoteWindow>** through a window animation object. 20 21**Parameters** 22 23| Name| Type| Mandatory | Description| 24| -------- | -------- | --------------- | -------- | 25| target | [WindowAnimationTarget](#windowanimationtarget) | Yes | Description of the animation window to control.| 26 27## WindowAnimationTarget 28 29Implements a target window, which is used to remotely control the animation. 30 31| Name | Type | Description| 32| ------- | ------ | ----------------------- | 33| bundleName | string | Process corresponding to the animation window.| 34| abilityName | string | Ability corresponding to the animation window.| 35| windowBounds | [RRect](#rrect) | Actual size of the animation window.| 36| missionId | number | Mission ID.| 37 38## RRect 39 40Implements a rounded rectangle. 41 42| Name | Type | Description| 43| ------- | ------ | ----------------------- | 44| left | number | Horizontal coordinate of the upper left corner of the animation window relative to the screen.| 45| top | number | Vertical coordinate of the upper left corner of the animation window relative to the screen.| 46| width | number | Width of the animation window.| 47| height | number | Height of the animation window.| 48| radius | number | Radius of the rounded corner of the animation window.| 49 50## Attributes 51 52The [universal attributes](ts-universal-attributes-size.md) are supported. 53 54## Events 55 56The [universal events](ts-universal-events-click.md) are supported. 57 58## Example 59The **\<RemoteWindow>** component needs to receive the **WindowAnimationTarget** object passed from the **WindowAnimationController** object set through [windowAnimationManager](../apis/js-apis-windowAnimationManager.md). You can create a **RemoteWindowExample.ets** file and encapsulate the **RemoteWindowExample** component and the passed **WindowAnimationTarget** object. 60The **\<RemoteWindow>** component can be used only in the system application Launcher. Therefore, you can place the **RemoteWindowExample** component in the **build** function of the **EntryView.ets** page of Launcher, compile Launcher, and push the Launcher installation package to the device system. 61 62```ts 63// WindowAnimationControllerImpl.ets file 64import windowAnimationManager from '@ohos.animation.windowAnimationManager'; 65 66export default class WindowAnimationControllerImpl implements windowAnimationManager.WindowAnimationController { 67 onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, 68 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void 69 { 70 console.log(`remote window animaion onStartAppFromLauncher`); 71 finishedCallback.onAnimationFinish(); 72 } 73 74 onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, 75 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 76 console.log(`remote window animaion onStartAppFromRecent`); 77 finishedCallback.onAnimationFinish(); 78 } 79 80 onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, 81 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 82 console.log(`remote window animaion onStartAppFromOther`); 83 finishedCallback.onAnimationFinish(); 84 } 85 86 onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, 87 toWindowTarget: windowAnimationManager.WindowAnimationTarget, 88 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void{ 89 console.log(`remote window animaion onAppTransition`); 90 finishedCallback.onAnimationFinish(); 91 } 92 93 onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, 94 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 95 console.log(`remote window animaion onMinimizeWindow`); 96 finishedCallback.onAnimationFinish(); 97 } 98 99 onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, 100 finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 101 console.log(`remote window animaion onCloseWindow`); 102 finishedCallback.onAnimationFinish(); 103 } 104 105 onScreenUnlock(finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 106 console.log(`remote window animaion onScreenUnlock`); 107 finishedCallback.onAnimationFinish(); 108 } 109 110 onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, 111 floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void { 112 console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget); 113 console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets); 114 } 115} 116``` 117 118```ts 119// RemoteWindowExample.ets file 120import windowAnimationManager from '@ohos.animation.windowAnimationManager'; 121import WindowAnimationControllerImpl from '../animation/remoteanimation/WindowAnimationControllerImpl'; 122 123@Entry 124@Component 125export default struct RemoteWindowExample { 126 @State target: WindowAnimationTarget = undefined // Obtained through windowAnimationManager. 127 128 aboutToAppear(): void { 129 let controller = new WindowAnimationControllerImpl(); 130 windowAnimationManager.setController(controller); 131 132 controller.onStartAppFromLauncher = (startingWindowTarget, finishedCallback) => { 133 console.log(`RemoteWindowExample: remote window animaion onStartAppFromLauncher`); 134 this.target = startingWindowTarget; 135 finishedCallback.onAnimationFinish(); 136 } 137 138 controller.onStartAppFromRecent = (startingWindowTarget, finishedCallback) => { 139 console.log(`RemoteWindowExample: remote window animaion onStartAppFromRecent`); 140 this.target = startingWindowTarget; 141 finishedCallback.onAnimationFinish(); 142 } 143 144 controller.onStartAppFromOther = (startingWindowTarget, finishedCallback) => { 145 console.log(`RemoteWindowExample: remote window animaion onStartAppFromOther`); 146 this.target = startingWindowTarget; 147 finishedCallback.onAnimationFinish(); 148 } 149 150 controller.onAppTransition = (fromWindowTarget, toWindowTarget, finishedCallback) => { 151 console.log(`RemoteWindowExample: remote window animaion onAppTransition`); 152 this.target = toWindowTarget; 153 finishedCallback.onAnimationFinish(); 154 } 155 156 controller.onMinimizeWindow = (minimizingWindowTarget, finishedCallback) => { 157 console.log(`RemoteWindowExample: remote window animaion onMinimizeWindow`); 158 this.target = minimizingWindowTarget; 159 finishedCallback.onAnimationFinish(); 160 } 161 162 controller.onCloseWindow = (closingWindowTarget, finishedCallback) => { 163 console.log(`RemoteWindowExample: remote window animaion onCloseWindow`); 164 this.target = closingWindowTarget; 165 finishedCallback.onAnimationFinish(); 166 } 167 } 168 169 build() { 170 Column() { 171 RemoteWindow(this.target) 172 .scale({ x: 0.5, y: 0.5}) // Used for demonstration purposes only. .In general cases, scale({ x: 1, y: 1 }) is required. 173 .position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) }) 174 .width(px2vp(this.target?.windowBounds.width)) 175 .height(px2vp(this.target?.windowBounds.height)) 176 } 177 } 178} 179``` 180