1e41f4b71Sopenharmony_ci# @ohos.animation.windowAnimationManager (窗口动画管理)(系统接口) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci窗口动画管理器,可以监听应用启动退出时应用的动画窗口,提供启动退出过程中控件动画和应用窗口联动动画能力。 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **说明:** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> - 该组件从API version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> - 本模块接口为系统接口。 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## 导入模块 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci```ts 14e41f4b71Sopenharmony_ciimport { windowAnimationManager } from '@kit.ArkUI'; 15e41f4b71Sopenharmony_ci``` 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## windowAnimationManager.setController 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_cisetController(controller: WindowAnimationController): void 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci设置窗口动画控制器。窗口动画控制器的说明请参考[WindowAnimationController](#windowanimationcontroller)。 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci在使用windowAnimationManager的其他接口前,需要预先调用本接口设置窗口动画控制器。 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci**参数:** 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 30e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 31e41f4b71Sopenharmony_ci| controller | [WindowAnimationController](#windowanimationcontroller) | 是 | 窗口动画的控制器。| 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**示例:** 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci```ts 36e41f4b71Sopenharmony_cilet controller: windowAnimationManager.WindowAnimationController = { 37e41f4b71Sopenharmony_ci onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 38e41f4b71Sopenharmony_ci console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget); 39e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 40e41f4b71Sopenharmony_ci }, 41e41f4b71Sopenharmony_ci onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 42e41f4b71Sopenharmony_ci console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget); 43e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 44e41f4b71Sopenharmony_ci }, 45e41f4b71Sopenharmony_ci onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 46e41f4b71Sopenharmony_ci console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget); 47e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 48e41f4b71Sopenharmony_ci }, 49e41f4b71Sopenharmony_ci onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 50e41f4b71Sopenharmony_ci console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget); 51e41f4b71Sopenharmony_ci console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget); 52e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 53e41f4b71Sopenharmony_ci }, 54e41f4b71Sopenharmony_ci onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 55e41f4b71Sopenharmony_ci console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget); 56e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 57e41f4b71Sopenharmony_ci }, 58e41f4b71Sopenharmony_ci onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 59e41f4b71Sopenharmony_ci console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget); 60e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 61e41f4b71Sopenharmony_ci }, 62e41f4b71Sopenharmony_ci onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 63e41f4b71Sopenharmony_ci console.log('onScreenUnlock called'); 64e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 65e41f4b71Sopenharmony_ci }, 66e41f4b71Sopenharmony_ci onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void { 67e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget); 68e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets); 69e41f4b71Sopenharmony_ci } 70e41f4b71Sopenharmony_ci} 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ciwindowAnimationManager.setController(controller); 73e41f4b71Sopenharmony_ci``` 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ci## windowAnimationManager.minimizeWindowWithAnimation 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ciminimizeWindowWithAnimation(windowTarget: WindowAnimationTarget, callback: AsyncCallback<WindowAnimationFinishedCallback>): void 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci最小化动画目标窗口,并返回动画完成的回调。使用callback异步回调 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci**参数:** 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 86e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 87e41f4b71Sopenharmony_ci| windowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。| 88e41f4b71Sopenharmony_ci| callback | AsyncCallback<[WindowAnimationFinishedCallback](#windowanimationfinishedcallback)> | 是 | 回调函数。当最小化动画目标窗口成功,err为undefined,data为获取到的WindowAnimationFinishedCallback;否则返回err.code为-1,data为undefined。| 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci**示例:** 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci```ts 93e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_cilet target: windowAnimationManager.WindowAnimationTarget | null = null; 96e41f4b71Sopenharmony_cilet controller: windowAnimationManager.WindowAnimationController = { 97e41f4b71Sopenharmony_ci onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 98e41f4b71Sopenharmony_ci console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget); 99e41f4b71Sopenharmony_ci target = startingWindowTarget; 100e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 101e41f4b71Sopenharmony_ci }, 102e41f4b71Sopenharmony_ci onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 103e41f4b71Sopenharmony_ci console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget); 104e41f4b71Sopenharmony_ci target = startingWindowTarget; 105e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 106e41f4b71Sopenharmony_ci }, 107e41f4b71Sopenharmony_ci onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 108e41f4b71Sopenharmony_ci console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget); 109e41f4b71Sopenharmony_ci target = startingWindowTarget; 110e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 111e41f4b71Sopenharmony_ci }, 112e41f4b71Sopenharmony_ci onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 113e41f4b71Sopenharmony_ci console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget); 114e41f4b71Sopenharmony_ci console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget); 115e41f4b71Sopenharmony_ci target = toWindowTarget; 116e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 117e41f4b71Sopenharmony_ci }, 118e41f4b71Sopenharmony_ci onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 119e41f4b71Sopenharmony_ci console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget); 120e41f4b71Sopenharmony_ci target = minimizingWindowTarget; 121e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 122e41f4b71Sopenharmony_ci }, 123e41f4b71Sopenharmony_ci onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 124e41f4b71Sopenharmony_ci console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget); 125e41f4b71Sopenharmony_ci target = closingWindowTarget; 126e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 127e41f4b71Sopenharmony_ci }, 128e41f4b71Sopenharmony_ci onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 129e41f4b71Sopenharmony_ci console.log('onScreenUnlock called'); 130e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 131e41f4b71Sopenharmony_ci }, 132e41f4b71Sopenharmony_ci onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void { 133e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget); 134e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets); 135e41f4b71Sopenharmony_ci target = fullScreenWindowTarget; 136e41f4b71Sopenharmony_ci } 137e41f4b71Sopenharmony_ci} 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ciwindowAnimationManager.setController(controller); 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_cilet finishedCallback: windowAnimationManager.WindowAnimationFinishedCallback; 142e41f4b71Sopenharmony_ciwindowAnimationManager.minimizeWindowWithAnimation(target, (err: BusinessError, data: windowAnimationManager.WindowAnimationFinishedCallback) => { 143e41f4b71Sopenharmony_ci if (err) { 144e41f4b71Sopenharmony_ci console.error('Failed to minimize the window target. Cause: ' + JSON.stringify(err)); 145e41f4b71Sopenharmony_ci return; 146e41f4b71Sopenharmony_ci } 147e41f4b71Sopenharmony_ci finishedCallback = data; 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ci // 在收到回调后,需要开始进行窗口动画,在窗口动画结束后,调用onAnimationFinish回调 150e41f4b71Sopenharmony_ci finishedCallback.onAnimationFinish(); 151e41f4b71Sopenharmony_ci}); 152e41f4b71Sopenharmony_ci``` 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ci## windowAnimationManager.minimizeWindowWithAnimation 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_ciminimizeWindowWithAnimation(windowTarget: WindowAnimationTarget): Promise<WindowAnimationFinishedCallback> 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci最小化动画目标窗口,并返回动画完成的回调。使用Promise异步回调。 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci**参数:** 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 165e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 166e41f4b71Sopenharmony_ci| windowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。| 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_ci**返回值:** 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci| 类型 | 说明 | 171e41f4b71Sopenharmony_ci| -------------------------------- | --------------------------------------- | 172e41f4b71Sopenharmony_ci| Promise<[WindowAnimationFinishedCallback](#windowanimationfinishedcallback)> | Promise对象,返回动画完成的回调。 | 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci 175e41f4b71Sopenharmony_ci**示例:** 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci```ts 178e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_cilet target: windowAnimationManager.WindowAnimationTarget | null = null; 181e41f4b71Sopenharmony_cilet controller: windowAnimationManager.WindowAnimationController = { 182e41f4b71Sopenharmony_ci onStartAppFromLauncher(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 183e41f4b71Sopenharmony_ci console.log('onStartAppFromLauncher, the startingWindowTarget is: ' + startingWindowTarget); 184e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 185e41f4b71Sopenharmony_ci }, 186e41f4b71Sopenharmony_ci onStartAppFromRecent(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 187e41f4b71Sopenharmony_ci console.log('onStartAppFromRecent, the startingWindowTarget is: ' + startingWindowTarget); 188e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 189e41f4b71Sopenharmony_ci }, 190e41f4b71Sopenharmony_ci onStartAppFromOther(startingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 191e41f4b71Sopenharmony_ci console.log('onStartAppFromOther, the startingWindowTarget is: ' + startingWindowTarget); 192e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 193e41f4b71Sopenharmony_ci }, 194e41f4b71Sopenharmony_ci onAppTransition(fromWindowTarget: windowAnimationManager.WindowAnimationTarget, toWindowTarget: WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 195e41f4b71Sopenharmony_ci console.log('onAppTransition, the fromWindowTarget is: ' + fromWindowTarget); 196e41f4b71Sopenharmony_ci console.log('onAppTransition, the toWindowTarget is: ' + toWindowTarget); 197e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 198e41f4b71Sopenharmony_ci }, 199e41f4b71Sopenharmony_ci onMinimizeWindow(minimizingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 200e41f4b71Sopenharmony_ci console.log('onMinimizeWindow, the minimizingWindowTarget is: ' + minimizingWindowTarget); 201e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 202e41f4b71Sopenharmony_ci }, 203e41f4b71Sopenharmony_ci onCloseWindow(closingWindowTarget: windowAnimationManager.WindowAnimationTarget, finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 204e41f4b71Sopenharmony_ci console.log('onCloseWindow, the closingWindowTarget is: ' + closingWindowTarget); 205e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 206e41f4b71Sopenharmony_ci }, 207e41f4b71Sopenharmony_ci onScreenUnlock(finishCallback: windowAnimationManager.WindowAnimationFinishedCallback): void { 208e41f4b71Sopenharmony_ci console.log('onScreenUnlock called'); 209e41f4b71Sopenharmony_ci finishCallback.onAnimationFinish(); 210e41f4b71Sopenharmony_ci }, 211e41f4b71Sopenharmony_ci onWindowAnimationTargetsUpdate(fullScreenWindowTarget: windowAnimationManager.WindowAnimationTarget, floatingWindowTargets: Array<windowAnimationManager.WindowAnimationTarget>): void { 212e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the fullScreenWindowTarget is: ' + fullScreenWindowTarget); 213e41f4b71Sopenharmony_ci console.log('onWindowAnimationTargetsUpdate, the floatingWindowTargets are: ' + floatingWindowTargets); 214e41f4b71Sopenharmony_ci } 215e41f4b71Sopenharmony_ci} 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ciwindowAnimationManager.setController(controller); 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_cilet promise: Promise<windowAnimationManager.WindowAnimationFinishedCallback> = windowAnimationManager.minimizeWindowWithAnimation(target); 220e41f4b71Sopenharmony_cipromise.then((data: windowAnimationManager.WindowAnimationFinishedCallback) => { 221e41f4b71Sopenharmony_ci data.onAnimationFinish(); 222e41f4b71Sopenharmony_ci}).catch((err: BusinessError)=>{ 223e41f4b71Sopenharmony_ci console.error('Failed to minimize the window target. Cause: ' + JSON.stringify(err)); 224e41f4b71Sopenharmony_ci return; 225e41f4b71Sopenharmony_ci}); 226e41f4b71Sopenharmony_ci``` 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ci## WindowAnimationController 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci窗口动画控制器。在创建一个WindowAnimationController对象时,需要实现其中的所有回调函数。 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci### onStartAppFromLauncher 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_cionStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci从桌面启动应用时的回调。 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 243e41f4b71Sopenharmony_ci| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | 244e41f4b71Sopenharmony_ci| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | 245e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 246e41f4b71Sopenharmony_ci 247e41f4b71Sopenharmony_ci**示例:** 248e41f4b71Sopenharmony_ci 249e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ci### onStartAppFromRecent 252e41f4b71Sopenharmony_ci 253e41f4b71Sopenharmony_cionStartAppFromRecent(startingWindowTarget: WindowAnimationTarget,finishCallback:WindowAnimationFinishedCallback): void 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_ci从最近任务列表启动应用时的回调。 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 258e41f4b71Sopenharmony_ci 259e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 260e41f4b71Sopenharmony_ci| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | 261e41f4b71Sopenharmony_ci| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | 262e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**示例:** 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_ci### onStartAppFromOther 269e41f4b71Sopenharmony_ci 270e41f4b71Sopenharmony_cionStartAppFromOther(startingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void 271e41f4b71Sopenharmony_ci 272e41f4b71Sopenharmony_ci从除了桌面和最近任务列表以外其他地方启动应用时的回调。 273e41f4b71Sopenharmony_ci 274e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 277e41f4b71Sopenharmony_ci| -------------------- | ------------------------------------------------------------ | ---- | ------------------ | 278e41f4b71Sopenharmony_ci| startingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | 279e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_ci**示例:** 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci### onAppTransition 286e41f4b71Sopenharmony_ci 287e41f4b71Sopenharmony_cionAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void 288e41f4b71Sopenharmony_ci 289e41f4b71Sopenharmony_ci应用转场时的回调。 290e41f4b71Sopenharmony_ci 291e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 294e41f4b71Sopenharmony_ci| -------------------- | ------------------------------- | ---- | ---------------- | 295e41f4b71Sopenharmony_ci| fromWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 转场前的动画窗口。 | 296e41f4b71Sopenharmony_ci| toWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 转场后的动画窗口。 | 297e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 298e41f4b71Sopenharmony_ci 299e41f4b71Sopenharmony_ci**示例:** 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci### onMinimizeWindow 304e41f4b71Sopenharmony_ci 305e41f4b71Sopenharmony_cionMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void 306e41f4b71Sopenharmony_ci 307e41f4b71Sopenharmony_ci最小化窗口时的回调。 308e41f4b71Sopenharmony_ci 309e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 310e41f4b71Sopenharmony_ci 311e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 312e41f4b71Sopenharmony_ci| -------------------- | ------------------------------- | ---- | ---------------- | 313e41f4b71Sopenharmony_ci| minimizingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | 314e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 315e41f4b71Sopenharmony_ci 316e41f4b71Sopenharmony_ci**示例:** 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci### onCloseWindow 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_cionCloseWindow(closingWindowTarget: WindowAnimationTarget,finishCallback: WindowAnimationFinishedCallback): void 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ci关闭窗口时的回调。 325e41f4b71Sopenharmony_ci 326e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 329e41f4b71Sopenharmony_ci| -------------------- | ------------------------------- | ---- | ---------------- | 330e41f4b71Sopenharmony_ci| closingWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 动画目标窗口。 | 331e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 332e41f4b71Sopenharmony_ci 333e41f4b71Sopenharmony_ci**示例:** 334e41f4b71Sopenharmony_ci 335e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 336e41f4b71Sopenharmony_ci 337e41f4b71Sopenharmony_ci### onScreenUnlock 338e41f4b71Sopenharmony_ci 339e41f4b71Sopenharmony_cionScreenUnlock(finishCallback: [WindowAnimationFinishedCallback](#windowanimationfinishedcallback)): void 340e41f4b71Sopenharmony_ci 341e41f4b71Sopenharmony_ci屏幕解锁时的回调。 342e41f4b71Sopenharmony_ci 343e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 344e41f4b71Sopenharmony_ci 345e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 346e41f4b71Sopenharmony_ci| -------------- | ------------------------------------------------------------ | ---- | ------------------ | 347e41f4b71Sopenharmony_ci| finishCallback | [WindowAnimationFinishedCallback](#windowanimationfinishedcallback) | 是 | 动画完成后的回调。 | 348e41f4b71Sopenharmony_ci 349e41f4b71Sopenharmony_ci**示例:** 350e41f4b71Sopenharmony_ci 351e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 352e41f4b71Sopenharmony_ci 353e41f4b71Sopenharmony_ci### onWindowAnimationTargetsUpdate 354e41f4b71Sopenharmony_ci 355e41f4b71Sopenharmony_cionWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget, floatingWindowTargets: Array<WindowAnimationTarget>): void 356e41f4b71Sopenharmony_ci 357e41f4b71Sopenharmony_ci动画目标窗口更新时的回调 358e41f4b71Sopenharmony_ci 359e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 360e41f4b71Sopenharmony_ci 361e41f4b71Sopenharmony_ci| 参数名 | 类型 | 必填 | 说明 | 362e41f4b71Sopenharmony_ci| -------------------- | ------------------------------- | ---- | ---------------- | 363e41f4b71Sopenharmony_ci| fullScreenWindowTarget | [WindowAnimationTarget](#windowanimationtarget) | 是 | 全屏状态的动画目标窗口。| 364e41f4b71Sopenharmony_ci| floatingWindowTargets| Array<[WindowAnimationTarget](#windowanimationtarget)> | 是 | 悬浮状态的动画目标窗口。 | 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ci**示例:** 367e41f4b71Sopenharmony_ci 368e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 369e41f4b71Sopenharmony_ci 370e41f4b71Sopenharmony_ci## WindowAnimationFinishedCallback 371e41f4b71Sopenharmony_ci动画完成后的回调。 372e41f4b71Sopenharmony_ci 373e41f4b71Sopenharmony_ci### onAnimationFinish 374e41f4b71Sopenharmony_ci 375e41f4b71Sopenharmony_cionAnimationFinish():void 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_ci结束本次动画。 378e41f4b71Sopenharmony_ci 379e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 380e41f4b71Sopenharmony_ci 381e41f4b71Sopenharmony_ci**示例:** 382e41f4b71Sopenharmony_ci 383e41f4b71Sopenharmony_ci请参考[windowAnimationManager.setController](#windowanimationmanagersetcontroller)的示例代码。 384e41f4b71Sopenharmony_ci 385e41f4b71Sopenharmony_ci## WindowAnimationTarget 386e41f4b71Sopenharmony_ci动画目标窗口,用来实现动画。 387e41f4b71Sopenharmony_ci 388e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 389e41f4b71Sopenharmony_ci 390e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 | 391e41f4b71Sopenharmony_ci| ------- | ------ | ------ | ----------------------- | 392e41f4b71Sopenharmony_ci| bundleName | string | 是 |动画目标窗口所对应的包名。 | 393e41f4b71Sopenharmony_ci| abilityName | string | 是 |动画目标窗口所对应的Ability名称。 | 394e41f4b71Sopenharmony_ci| windowBounds | [RRect](#rrect) | 是 |动画目标窗口所对应的实际大小。 | 395e41f4b71Sopenharmony_ci| missionId | number | 是 |任务ID,多任务中用于与ability进行匹配。| 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci## RRect 398e41f4b71Sopenharmony_ci圆角矩形。 399e41f4b71Sopenharmony_ci 400e41f4b71Sopenharmony_ci**系统能力:** SystemCapability.WindowManager.WindowManager.Core 401e41f4b71Sopenharmony_ci 402e41f4b71Sopenharmony_ci| 名称 | 类型 | 必填 | 说明 | 403e41f4b71Sopenharmony_ci| ------- | ------ | ------|----------------------- | 404e41f4b71Sopenharmony_ci| left | number | 是 |动画目标窗口左上角相对于屏幕的横坐标。 | 405e41f4b71Sopenharmony_ci| top | number | 是 |动画目标窗口左上角相对于屏幕的纵坐标。 | 406e41f4b71Sopenharmony_ci| width | number | 是 |动画目标窗口的宽度大小。 | 407e41f4b71Sopenharmony_ci| height | number | 是 |动画目标窗口的高度大小。 | 408e41f4b71Sopenharmony_ci| radius | number | 是 |动画目标窗口的圆角大小。 |