1# @ohos.animator (Animator) 2 3The **Animator** module provides APIs for applying animation effects, including defining animations, starting animations, and playing animations in reverse order. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> This module can be used in ArkTS since API version 9. 10> 11> This module cannot be used in the file declaration of the [UIAbility](../apis-ability-kit/js-apis-app-ability-uiAbility.md). In other words, the APIs of this module can be used only after a component instance is created; they cannot be called in the lifecycle of the UIAbility. 12> 13> The functionality of this module depends on UI context. This means that the APIs of this module cannot be used where the UI context is unclear. For details, see [UIContext](js-apis-arkui-UIContext.md#uicontext). 14> 15> Since API version 10, you can use the [createAnimator](js-apis-arkui-UIContext.md#createanimator) API in [UIContext](js-apis-arkui-UIContext.md#uicontext) to obtain the UI context. 16 17## Modules to Import 18 19```ts 20import { Animator as animator, AnimatorOptions,AnimatorResult } from '@kit.ArkUI'; 21``` 22## create<sup>9+</sup> 23 24create(options: AnimatorOptions): AnimatorResult 25 26Creates an **Animator** object. 27 28**Atomic service API**: This API can be used in atomic services since API version 11. 29 30**System capability**: SystemCapability.ArkUI.ArkUI.Full 31 32**Parameters** 33 34| Name | Type | Mandatory | Description | 35| ------- | ----------------------------------- | ---- | ------- | 36| options | [AnimatorOptions](#animatoroptions) | Yes | Animator options. | 37 38**Return value** 39 40| Type | Description | 41| --------------------------------- | ------------- | 42| [AnimatorResult](#animatorresult) | Animator result. | 43 44**Error codes** 45 46For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 47 48| ID | Error Message | 49| ------- | -------- | 50| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | 51 52**Example** 53 54 ```ts 55import {Animator as animator, AnimatorOptions, AnimatorResult } from '@kit.ArkUI'; 56import { BusinessError } from '@kit.BasicServicesKit'; 57let options: AnimatorOptions = { 58 duration: 1500, 59 easing: "friction", 60 delay: 0, 61 fill: "forwards", 62 direction: "normal", 63 iterations: 3, 64 begin: 200.0, 65 end: 400.0 66}; 67animator.create(options); 68 ``` 69 70## AnimatorResult 71 72Defines the animator result. 73 74### reset<sup>9+</sup> 75 76reset(options: AnimatorOptions): void 77 78Updates this animator. 79 80**Atomic service API**: This API can be used in atomic services since API version 11. 81 82**System capability**: SystemCapability.ArkUI.ArkUI.Full 83 84**Parameters** 85 86| Name | Type | Mandatory | Description | 87| ------- | ----------------------------------- | ---- | ------- | 88| options | [AnimatorOptions](#animatoroptions) | Yes | Animator options. | 89 90**Error codes** 91 92For details about the error codes, see [Animator Error Codes](errorcode-animator.md). 93 94| ID | Error Message | 95| --------- | ------- | 96| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed. | 97| 100001 | The specified page is not found or the object property list is not obtained.| 98 99 100**Example** 101 102```ts 103import {Animator as animator, AnimatorOptions, AnimatorResult } from '@kit.ArkUI'; 104import { BusinessError } from '@kit.BasicServicesKit'; 105let options: AnimatorOptions = { 106 duration: 1500, 107 easing: "friction", 108 delay: 0, 109 fill: "forwards", 110 direction: "normal", 111 iterations: 3, 112 begin: 200.0, 113 end: 400.0 114}; 115let optionsNew: AnimatorOptions = { 116 duration: 1500, 117 easing: "friction", 118 delay: 0, 119 fill: "forwards", 120 direction: "normal", 121 iterations: 5, 122 begin: 200.0, 123 end: 400.0 124}; 125try { 126 let animatorResult:AnimatorResult|undefined = animator.create(options) 127 animatorResult.reset(optionsNew); 128} catch(error) { 129 let message = (error as BusinessError).message 130 let code = (error as BusinessError).code 131 console.error(`Animator reset failed, error code: ${code}, message: ${message}.`); 132} 133``` 134 135### play 136 137play(): void 138 139Plays this animation. The animation retains the previous playback state. For example, if the animation is set to **reverse** and paused, it will remain in **reverse** when resumed. 140 141**Atomic service API**: This API can be used in atomic services since API version 11. 142 143**System capability**: SystemCapability.ArkUI.ArkUI.Full 144 145**Example** 146 147```ts 148animator.play(); 149``` 150 151### finish 152 153finish(): void 154 155Ends this animation. 156 157**Atomic service API**: This API can be used in atomic services since API version 11. 158 159**System capability**: SystemCapability.ArkUI.ArkUI.Full 160 161**Example** 162 163```ts 164animator.finish(); 165``` 166 167### pause 168 169pause(): void 170 171Pauses this animation. 172 173**Atomic service API**: This API can be used in atomic services since API version 11. 174 175**System capability**: SystemCapability.ArkUI.ArkUI.Full 176 177**Example** 178 179```ts 180animator.pause(); 181``` 182 183### cancel 184 185cancel(): void 186 187Cancels this animation. 188 189**Atomic service API**: This API can be used in atomic services since API version 11. 190 191**System capability**: SystemCapability.ArkUI.ArkUI.Full 192 193**Example** 194 195```ts 196animator.cancel(); 197``` 198 199### reverse 200 201reverse(): void 202 203Plays this animation in reverse order. This API does not take effect when the interpolating spring curve is used. 204 205**Atomic service API**: This API can be used in atomic services since API version 11. 206 207**System capability**: SystemCapability.ArkUI.ArkUI.Full 208 209**Example** 210 211```ts 212animator.reverse(); 213``` 214 215### onFrame<sup>12+</sup> 216 217onFrame: (progress: number) => void 218 219Called when a frame is received. 220 221**Atomic service API**: This API can be used in atomic services since API version 12. 222 223**System capability**: SystemCapability.ArkUI.ArkUI.Full 224 225**Parameters** 226 227| Name | Type | Mandatory | Description | 228| -------- | ------ | ---- | -------- | 229| progress | number | Yes | Current value of the animation. | 230 231**Example** 232 233```ts 234import {Animator as animator, AnimatorResult } from '@kit.ArkUI'; 235let animatorResult:AnimatorResult|undefined = animator.create(options) 236animatorResult.onFrame = (value:number)=> { 237 console.info("onFrame callback") 238} 239``` 240 241### onFinish<sup>12+</sup> 242 243onFinish: () => void 244 245Called when this animation is finished. 246 247**Atomic service API**: This API can be used in atomic services since API version 12. 248 249**System capability**: SystemCapability.ArkUI.ArkUI.Full 250 251**Example** 252 253```ts 254import {Animator as animator, AnimatorResult } from '@kit.ArkUI'; 255let animatorResult:AnimatorResult|undefined = animator.create(options) 256animatorResult.onFinish = ()=> { 257 console.info("onFinish callback") 258} 259``` 260 261### onCancel<sup>12+</sup> 262 263onCancel: () => void 264 265Called when this animation is canceled. 266 267**Atomic service API**: This API can be used in atomic services since API version 12. 268 269**System capability**: SystemCapability.ArkUI.ArkUI.Full 270 271**Example** 272 273```ts 274import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 275let animatorResult:AnimatorResult|undefined = animator.create(options) 276animatorResult.onCancel = ()=> { 277 console.info("onCancel callback") 278} 279``` 280 281### onRepeat<sup>12+</sup> 282 283onRepeat: () => void 284 285Called when this animation repeats. 286 287**Atomic service API**: This API can be used in atomic services since API version 12. 288 289**System capability**: SystemCapability.ArkUI.ArkUI.Full 290 291**Example** 292 293```ts 294import {Animator as animator, AnimatorResult} from '@kit.ArkUI'; 295let animatorResult:AnimatorResult|undefined = animator.create(options) 296animatorResult.onRepeat = ()=> { 297 console.info("onRepeat callback") 298} 299``` 300 301### onframe<sup>(deprecated)</sup> 302 303> **NOTE** 304> 305> This API is deprecated since API version 12. You are advised to use [onFrame](#onframe12) instead. 306 307onframe: (progress: number) => void 308 309Called when a frame is received. 310 311**Atomic service API**: This API can be used in atomic services since API version 11. 312 313**System capability**: SystemCapability.ArkUI.ArkUI.Full 314 315**Parameters** 316 317| Name | Type | Mandatory | Description | 318| -------- | ------ | ---- | -------- | 319| progress | number | Yes | Current progress of the animation. | 320 321**Example** 322 323```ts 324import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 325let animatorResult:AnimatorResult|undefined = animator.create(options) 326animatorResult.onframe = (value)=> { 327 console.info("onframe callback") 328} 329``` 330 331### onfinish<sup>(deprecated)</sup> 332 333> **NOTE** 334> 335> This API is deprecated since API version 12. You are advised to use [onFinish](#onfinish12) instead. 336 337onfinish: () => void 338 339Called when this animation is finished. 340 341**Atomic service API**: This API can be used in atomic services since API version 11. 342 343**System capability**: SystemCapability.ArkUI.ArkUI.Full 344 345**Example** 346 347```ts 348import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 349let animatorResult:AnimatorResult|undefined = animator.create(options) 350animatorResult.onfinish = ()=> { 351 console.info("onfinish callback") 352} 353``` 354 355### oncancel<sup>(deprecated)</sup> 356 357> **NOTE** 358> 359> This API is deprecated since API version 12. You are advised to use [onCancel](#oncancel12) instead. 360 361 362oncancel: () => void 363 364Called when this animation is canceled. 365 366**Atomic service API**: This API can be used in atomic services since API version 11. 367 368**System capability**: SystemCapability.ArkUI.ArkUI.Full 369 370**Example** 371 372```ts 373import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 374let animatorResult:AnimatorResult|undefined = animator.create(options) 375animatorResult.oncancel = ()=> { 376 console.info("oncancel callback") 377} 378``` 379 380### onrepeat<sup>(deprecated)</sup> 381 382> **NOTE** 383> 384> This API is deprecated since API version 12. You are advised to use [onRepeat](#onrepeat12) instead. 385 386onrepeat: () => void 387 388Called when this animation repeats. 389 390**System capability**: SystemCapability.ArkUI.ArkUI.Full 391 392**Example** 393 394```ts 395import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 396let animatorResult:AnimatorResult|undefined = animator.create(options) 397animatorResult.onrepeat = ()=> { 398 console.info("onrepeat callback") 399} 400``` 401 402### setExpectedFrameRateRange<sup>12+</sup> 403 404setExpectedFrameRateRange(rateRange: ExpectedFrameRateRange): void 405 406Sets the expected frame rate range. 407 408**Atomic service API**: This API can be used in atomic services since API version 12. 409 410**System capability**: SystemCapability.ArkUI.ArkUI.Full 411 412**Parameters** 413 414| Name | Type | Mandatory | Description | 415| --------------- | ------------------------------------------ | ---- | -----------------------------| 416| rateRange | [ExpectedFrameRateRange](../apis-arkui/arkui-ts/ts-explicit-animation.md#expectedframeraterange11)| Yes | Expected frame rate range.| 417 418**Example** 419 420```ts 421import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 422let animatorResult: AnimatorResult | undefined = animator.create({ 423 duration: 2000, 424 easing: "ease", 425 delay: 0, 426 fill: "forwards", 427 direction: "normal", 428 iterations: 1, 429 begin: 100, 430 end: 200 431}) 432let expectedFrameRate: ExpectedFrameRateRange = { 433 min: 0, 434 max: 120, 435 expected: 30 436} 437animatorResult.setExpectedFrameRateRange(expectedFrameRate); 438``` 439 440## AnimatorOptions 441 442Animator options. 443 444**Atomic service API**: This API can be used in atomic services since API version 11. 445 446**System capability**: SystemCapability.ArkUI.ArkUI.Full 447 448| Name | Type | Mandatory | Description | 449| ---------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | 450| duration | number | Yes | Duration for playing the animation, in milliseconds.<br>Default value: **0** | 451| easing | string | Yes | Animation interpolation curve. Only the following values are supported:<br>**"linear"**: The animation speed keeps unchanged.<br>**"ease"**: The animation starts slowly, accelerates, and then slows down towards the end. The cubic-bezier curve (0.25, 0.1, 0.25, 1.0) is used.<br>**"ease-in"**: The animation starts at a low speed and then picks up speed until the end. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used.<br>**"ease-out"**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used.<br>**"ease-in-out"**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used.<br>**"fast-out-slow-in"**: The animation uses the standard cubic-bezier curve (0.4, 0.0, 0.2, 1.0).<br>**"linear-out-slow-in"**: The animation uses the deceleration cubic-bezier curve (0.0, 0.0, 0.2, 1.0).<br>**"fast-out-linear-in"**: The animation uses acceleration cubic-bezier curve (0.4, 0.0, 1.0, 1.0)<br>**"friction"**: The animation uses the damping cubic-bezier curve (0.2, 0.0, 0.2, 1.0).<br>**"extreme-deceleration"**: The animation uses the extreme deceleration cubic-bezier curve (0.0, 0.0, 0.0, 1.0).<br>**"rhythm"**: The animation uses the rhythm cubic-bezier curve (0.7, 0.0, 0.2, 1.0).<br>**"sharp"**: The animation uses the sharp cubic-bezier curve (0.33, 0.0, 0.67, 1.0).<br>**"smooth"**: The animation uses the smooth cubic-bezier curve (0.4, 0.0, 0.4, 1.0).<br>**"cubic-bezier(x1,y1,x2,y2)"**: The animation uses the defined cubic bezier curve, where the value of **x1** and **x2** must range from 0 to 1. For example, **"cubic-bezier(0.42,0.0,0.58,1.0)"**.<br>**"steps(number,step-position)"**: The animation uses a step curve. The **number** parameter is mandatory and must be set to a positive integer. The **step-position** parameter is optional and can be set to **start** or **end** (default value). For example, **"steps(3,start)"**.<br>**"interpolating-spring(velocity,mass,stiffness,damping)"**: The animation uses an interpolating spring curve. This API is supported since API version 11 and can be used only in ArkTS. The **velocity**, **mass**, **stiffness**, and **damping** parameters are of the numeric type, and the values of **mass**, **stiffness**, and **damping** must be greater than 0. For details about the parameters, see [Curves.interpolatingSpring](./js-apis-curve.md#curvesinterpolatingspring10). When an interpolating spring curve is used, settings for the **duration**, **fill**, **direction**, and **iterations** do not take effect. Rather, the value of **duration** is subject to the spring settings, **fill** is fixed at **forwards**, **direction** at **normal**, and **iterations** at **1**. In addition, invoking [reverse](#reverse) of **animator** is not effective. In other words, when using an interpolating spring curve, the animation can play only once in forward mode.<br>Default value: **"ease"** | 452| delay | number | Yes | Animation delay duration, in milliseconds. Value **0** means that there is no delay. If the value specified is a negative number, the animation starts playing ahead of its scheduled time. If the amount of time by which the playback is advanced is greater than the total duration of the animation, the animation skips to the end state immediately.<br>Default value: **0** | 453| fill | "none" \| "forwards" \| "backwards" \| "both" | Yes | State of the animated target after the animation is executed.<br>**"none"**: No style is applied to the target before or after the animation is executed.<br>**"forwards"**: The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.<br>**"backwards"**: The animation uses the value defined in the first key frame during the **animation-delay**. When **animation-direction** is set to **normal** or **alternate**, the value in the **from** key frame is used. When **animation-direction** is set to **reverse** or **alternate-reverse**, the value in the **to** key frame is used.<br>**"both"**: The animation follows the **forwards** and **backwards** rules. | 454| direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | Yes | Animation playback mode.<br>**"normal"**: plays the animation in forward loop mode.<br>**"reverse"**: plays the animation in reverse loop mode.<br>**"alternate"**: plays the animation in alternating loop mode. When the animation is played for an odd number of times, the playback is in forward direction. When the animation is played for an even number of times, the playback is in reverse direction.<br>**"alternate-reverse"**: plays the animation in reverse alternating loop mode. When the animation is played for an odd number of times, the playback is in reverse direction. When the animation is played for an even number of times, the playback is in forward direction.<br>Default value: **'normal'** | 455| iterations | number | Yes | Number of times that the animation is played. The value **0** means not to play the animation, and **-1** means to play the animation for an unlimited number of times.<br>**NOTE**<br>If this parameter is set to a negative value other than **-1**, the value is invalid. In this case, the animation is played once. | 456| begin | number | Yes | Start point of the animation interpolation.<br>Default value: **0** | 457| end | number | Yes | End point of animation interpolation.<br>Default value: **1** | 458 459 460## Example 461### JavaScript-compatible Web-like Development Paradigm 462 463```html 464<!-- hml --> 465<div class="container"> 466 <div class="Animation" style="height: {{divHeight}}px; width: {{divWidth}}px; background-color: red;" onclick="Show"> 467 </div> 468</div> 469``` 470 471```ts 472import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 473import { BusinessError } from '@kit.BasicServicesKit'; 474let DataTmp:Record<string,Animator> = { 475 'divWidth': 200, 476 'divHeight': 200, 477 'animator': animator 478} 479class Tmp{ 480 data:animator = DataTmp 481 onInit:Function = ()=>{} 482 Show:Function = ()=>{} 483} 484class DateT{ 485 divWidth:number = 0 486 divHeight:number = 0 487 animator:AnimatorResult | null = null 488} 489(Fn:(v:Tmp) => void) => {Fn({ 490 data: DataTmp, 491 onInit() { 492 let options:AnimatorOptions = { 493 duration: 1500, 494 easing: "friction", 495 delay: 0, 496 fill: "forwards", 497 direction: "normal", 498 iterations: 2, 499 begin: 200.0, 500 end: 400.0 501 }; 502 let DataTmp:DateT = { 503 divWidth: 200, 504 divHeight: 200, 505 animator: null 506 } 507 DataTmp.animator = animator.create(options); 508 }, 509 Show() { 510 let options1:AnimatorOptions = { 511 duration: 1500, 512 easing: "friction", 513 delay: 0, 514 fill: "forwards", 515 direction: "normal", 516 iterations: 2, 517 begin: 0, 518 end: 400.0, 519 }; 520 let DataTmp:DateT = { 521 divWidth: 200, 522 divHeight: 200, 523 animator: null 524 } 525 try { 526 DataTmp.animator = animator.create(options1); 527 DataTmp.animator.reset(options1); 528 } catch(error) { 529 let message = (error as BusinessError).message 530 let code = (error as BusinessError).code 531 console.error(`Animator reset failed, error code: ${code}, message: ${message}.`); 532 } 533 let _this = DataTmp; 534 if(DataTmp.animator){ 535 DataTmp.animator.onFrame = (value:number)=> { 536 _this.divWidth = value; 537 _this.divHeight = value; 538 }; 539 DataTmp.animator.play(); 540 } 541 } 542})} 543``` 544 545  546 547### ArkTS-based Declarative Development Paradigm 548 549```ts 550import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 551 552 553@Entry 554@Component 555struct AnimatorTest { 556 private TAG: string = '[AnimatorTest]' 557 private backAnimator: AnimatorResult | undefined = undefined 558 private flag: boolean = false 559 @State wid: number = 100 560 @State hei: number = 100 561 562 create() { 563 let _this = this 564 this.backAnimator = animator.create({ 565 duration: 2000, 566 easing: "ease", 567 delay: 0, 568 fill: "forwards", 569 direction: "normal", 570 iterations: 1, 571 begin: 100, 572 end: 200 573 }) 574 this.backAnimator.onFinish = ()=> { 575 _this.flag = true 576 console.info(_this.TAG, 'backAnimator onfinish') 577 } 578 this.backAnimator.onRepeat = ()=> { 579 console.info(_this.TAG, 'backAnimator repeat') 580 } 581 this.backAnimator.onCancel = ()=> { 582 console.info(_this.TAG, 'backAnimator cancel') 583 } 584 this.backAnimator.onFrame = (value:number)=> { 585 _this.wid = value 586 _this.hei = value 587 } 588 } 589 590 aboutToDisappear() { 591 // Because backAnimator references this in onframe, backAnimator is saved in this. 592 // When the custom component disappears, leave backAnimator empty to avoid memory leak. 593 this.backAnimator = undefined; 594 } 595 596 build() { 597 Column() { 598 Column() { 599 Column() 600 .width(this.wid) 601 .height(this.hei) 602 .backgroundColor(Color.Red) 603 } 604 .width('100%') 605 .height(300) 606 607 Column() { 608 Row() { 609 Button('create') 610 .fontSize(30) 611 .fontColor(Color.Black) 612 .onClick(() => { 613 this.create() 614 }) 615 } 616 .padding(10) 617 618 Row() { 619 Button('play') 620 .fontSize(30) 621 .fontColor(Color.Black) 622 .onClick(() => { 623 this.flag = false 624 if(this.backAnimator){ 625 this.backAnimator.play() 626 } 627 }) 628 } 629 .padding(10) 630 631 Row() { 632 Button('pause') 633 .fontSize(30) 634 .fontColor(Color.Black) 635 .onClick(() => { 636 if(this.backAnimator){ 637 this.backAnimator.pause() 638 } 639 }) 640 } 641 .padding(10) 642 643 Row() { 644 Button('finish') 645 .fontSize(30) 646 .fontColor(Color.Black) 647 .onClick(() => { 648 this.flag = true 649 if(this.backAnimator){ 650 this.backAnimator.finish() 651 } 652 }) 653 } 654 .padding(10) 655 656 Row() { 657 Button('reverse') 658 .fontSize(30) 659 .fontColor(Color.Black) 660 .onClick(() => { 661 this.flag = false 662 if(this.backAnimator){ 663 this.backAnimator.reverse() 664 } 665 }) 666 } 667 .padding(10) 668 669 Row() { 670 Button('cancel') 671 .fontSize(30) 672 .fontColor(Color.Black) 673 .onClick(() => { 674 if(this.backAnimator){ 675 this.backAnimator.cancel() 676 } 677 }) 678 } 679 .padding(10) 680 681 Row() { 682 Button('reset') 683 .fontSize(30) 684 .fontColor(Color.Black) 685 .onClick(() => { 686 if (this.flag) { 687 this.flag = false 688 if(this.backAnimator){ 689 this.backAnimator.reset({ 690 duration: 3000, 691 easing: "ease-in", 692 delay: 0, 693 fill: "forwards", 694 direction: "alternate", 695 iterations: 3, 696 begin: 100, 697 end: 300 698 }) 699 } 700 } else { 701 console.info(this.TAG, 'Animation not ended') 702 } 703 }) 704 } 705 .padding(10) 706 } 707 } 708 } 709} 710``` 711 712## update<sup>(deprecated)</sup> 713 714update(options: AnimatorOptions): void 715 716Updates this animator. 717 718This API is deprecated since API version 9. You are advised to use [reset<sup>9+</sup>](#reset9) instead. 719 720**System capability**: SystemCapability.ArkUI.ArkUI.Full 721 722**Parameters** 723 724| Name | Type | Mandatory | Description | 725| ------- | ----------------------------------- | ---- | ------- | 726| options | [AnimatorOptions](#animatoroptions) | Yes | Animator options. | 727 728**Example** 729 730```ts 731animator.update(options); 732``` 733 734## createAnimator<sup>(deprecated)</sup> 735 736createAnimator(options: AnimatorOptions): AnimatorResult 737 738Creates an **Animator** object. 739 740This API is deprecated since API version 9. You are advised to use [create<sup>9+</sup>](#create9) instead. 741 742**System capability**: SystemCapability.ArkUI.ArkUI.Full 743 744**Parameters** 745 746| Name | Type | Mandatory | Description | 747| ------- | ----------------------------------- | ---- | ------- | 748| options | [AnimatorOptions](#animatoroptions) | Yes | Animator options. | 749 750**Return value** 751 752| Type | Description | 753| --------------------------------- | ------------- | 754| [AnimatorResult](#animatorresult) | Animator result. | 755 756**Example** 757 758```ts 759import { Animator as animator, AnimatorResult } from '@kit.ArkUI'; 760 761let options: AnimatorOptions = { // The explicit type AnimatorOptions does not need to be emphasized in a .js file. 762 duration: 1500, 763 easing: "friction", 764 delay: 0, 765 fill: "forwards", 766 direction: "normal", 767 iterations: 3, 768 begin: 200.0, 769 end: 400.0, 770}; 771this.animator = animator.createAnimator(options); 772``` 773