1/* 2 * Copyright (c) 2021-2023 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 * @file 18 * @kit ArkUI 19 */ 20 21/*** if arkts 1.2 */ 22import { Resource } from "../../global/resource"; 23import { CommonMethod, PixelMap } from './common' 24import { AnimationStatus,FillMode } from './enums' 25/*** endif */ 26 27/** 28 * Defines the ImageAnimator Interface. 29 * 30 * @interface ImageAnimatorInterface 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @since 7 33 */ 34/** 35 * Defines the ImageAnimator Interface. 36 * 37 * @interface ImageAnimatorInterface 38 * @syscap SystemCapability.ArkUI.ArkUI.Full 39 * @crossplatform 40 * @form 41 * @since 10 42 */ 43/** 44 * Defines the ImageAnimator Interface. 45 * 46 * @interface ImageAnimatorInterface 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @crossplatform 49 * @form 50 * @atomicservice 51 * @since arkts {'1.1':'11','1.2':'20'} 52 * @arkts 1.1&1.2 53 */ 54interface ImageAnimatorInterface { 55 /** 56 * ImageAnimator is returned. 57 * 58 * @returns { ImageAnimatorAttribute } 59 * @syscap SystemCapability.ArkUI.ArkUI.Full 60 * @since 7 61 */ 62 /** 63 * ImageAnimator is returned. 64 * 65 * @returns { ImageAnimatorAttribute } 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @crossplatform 68 * @form 69 * @since 10 70 */ 71 /** 72 * ImageAnimator is returned. 73 * 74 * @returns { ImageAnimatorAttribute } 75 * @syscap SystemCapability.ArkUI.ArkUI.Full 76 * @crossplatform 77 * @form 78 * @atomicservice 79 * @since arkts {'1.1':'11','1.2':'20'} 80 * @arkts 1.1&1.2 81 */ 82 (): ImageAnimatorAttribute; 83} 84 85/** 86 * Defines the ImageFrameInfo Interface. 87 * 88 * @interface ImageFrameInfo 89 * @syscap SystemCapability.ArkUI.ArkUI.Full 90 * @since 7 91 */ 92/** 93 * Defines the ImageFrameInfo Interface. 94 * 95 * @interface ImageFrameInfo 96 * @syscap SystemCapability.ArkUI.ArkUI.Full 97 * @crossplatform 98 * @form 99 * @since 10 100 */ 101/** 102 * Defines the ImageFrameInfo Interface. 103 * 104 * @interface ImageFrameInfo 105 * @syscap SystemCapability.ArkUI.ArkUI.Full 106 * @crossplatform 107 * @form 108 * @atomicservice 109 * @since arkts {'1.1':'11','1.2':'20'} 110 * @arkts 1.1&1.2 111 */ 112interface ImageFrameInfo { 113 /** 114 * Image path 115 * 116 * @type { string } 117 * @syscap SystemCapability.ArkUI.ArkUI.Full 118 * @since 7 119 */ 120 /** 121 * Image path 122 * 123 * @type { string | Resource } 124 * @syscap SystemCapability.ArkUI.ArkUI.Full 125 * @since 9 126 */ 127 /** 128 * Image path 129 * 130 * @type { string | Resource } 131 * @syscap SystemCapability.ArkUI.ArkUI.Full 132 * @crossplatform 133 * @form 134 * @since 10 135 */ 136 /** 137 * Image path 138 * 139 * @type { string | Resource } 140 * @syscap SystemCapability.ArkUI.ArkUI.Full 141 * @crossplatform 142 * @form 143 * @atomicservice 144 * @since 11 145 */ 146 /** 147 * Image path 148 * 149 * @type { string | Resource | PixelMap } 150 * @syscap SystemCapability.ArkUI.ArkUI.Full 151 * @crossplatform 152 * @form 153 * @atomicservice 154 * @since arkts {'1.1':'12','1.2':'20'} 155 * @arkts 1.1&1.2 156 */ 157 src: string | Resource | PixelMap; 158 /** 159 * Image width 160 * 161 * @type { ?(number | string) } 162 * @syscap SystemCapability.ArkUI.ArkUI.Full 163 * @since 7 164 */ 165 /** 166 * Image width 167 * 168 * @type { ?(number | string) } 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @crossplatform 171 * @form 172 * @since 10 173 */ 174 /** 175 * Image width 176 * 177 * @type { ?(number | string) } 178 * @syscap SystemCapability.ArkUI.ArkUI.Full 179 * @crossplatform 180 * @form 181 * @atomicservice 182 * @since arkts {'1.1':'11','1.2':'20'} 183 * @arkts 1.1&1.2 184 */ 185 width?: number | string; 186 /** 187 * Image height 188 * 189 * @type { ?(number | string) } 190 * @syscap SystemCapability.ArkUI.ArkUI.Full 191 * @since 7 192 */ 193 /** 194 * Image height 195 * 196 * @type { ?(number | string) } 197 * @syscap SystemCapability.ArkUI.ArkUI.Full 198 * @crossplatform 199 * @form 200 * @since 10 201 */ 202 /** 203 * Image height 204 * 205 * @type { ?(number | string) } 206 * @syscap SystemCapability.ArkUI.ArkUI.Full 207 * @crossplatform 208 * @form 209 * @atomicservice 210 * @since arkts {'1.1':'11','1.2':'20'} 211 * @arkts 1.1&1.2 212 */ 213 height?: number | string; 214 /** 215 * Vertical coordinate of the image relative to the upper left corner of the component 216 * 217 * @type { ?(number | string) } 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @since 7 220 */ 221 /** 222 * Vertical coordinate of the image relative to the upper left corner of the component 223 * 224 * @type { ?(number | string) } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @crossplatform 227 * @form 228 * @since 10 229 */ 230 /** 231 * Vertical coordinate of the image relative to the upper left corner of the component 232 * 233 * @type { ?(number | string) } 234 * @syscap SystemCapability.ArkUI.ArkUI.Full 235 * @crossplatform 236 * @form 237 * @atomicservice 238 * @since arkts {'1.1':'11','1.2':'20'} 239 * @arkts 1.1&1.2 240 */ 241 top?: number | string; 242 /** 243 * Horizontal coordinate of the image relative to the upper left corner of the component 244 * 245 * @type { ?(number | string) } 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @since 7 248 */ 249 /** 250 * Horizontal coordinate of the image relative to the upper left corner of the component 251 * 252 * @type { ?(number | string) } 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @crossplatform 255 * @form 256 * @since 10 257 */ 258 /** 259 * Horizontal coordinate of the image relative to the upper left corner of the component 260 * 261 * @type { ?(number | string) } 262 * @syscap SystemCapability.ArkUI.ArkUI.Full 263 * @crossplatform 264 * @form 265 * @atomicservice 266 * @since arkts {'1.1':'11','1.2':'20'} 267 * @arkts 1.1&1.2 268 */ 269 left?: number | string; 270 /** 271 * Playback duration of this image frame, in milliseconds. 272 * 273 * @type { ?number } 274 * @syscap SystemCapability.ArkUI.ArkUI.Full 275 * @since 7 276 */ 277 /** 278 * Playback duration of this image frame, in milliseconds. 279 * 280 * @type { ?number } 281 * @syscap SystemCapability.ArkUI.ArkUI.Full 282 * @crossplatform 283 * @since 10 284 */ 285 /** 286 * Playback duration of this image frame, in milliseconds. 287 * 288 * @type { ?number } 289 * @syscap SystemCapability.ArkUI.ArkUI.Full 290 * @crossplatform 291 * @atomicservice 292 * @since arkts {'1.1':'11','1.2':'20'} 293 * @arkts 1.1&1.2 294 */ 295 duration?: number; 296} 297 298/** 299 * inheritance CommonMethod 300 * 301 * @extends CommonMethod<ImageAnimatorAttribute> 302 * @syscap SystemCapability.ArkUI.ArkUI.Full 303 * @since 7 304 */ 305/** 306 * inheritance CommonMethod 307 * 308 * @extends CommonMethod<ImageAnimatorAttribute> 309 * @syscap SystemCapability.ArkUI.ArkUI.Full 310 * @crossplatform 311 * @form 312 * @since 10 313 */ 314/** 315 * inheritance CommonMethod 316 * 317 * @extends CommonMethod<ImageAnimatorAttribute> 318 * @syscap SystemCapability.ArkUI.ArkUI.Full 319 * @crossplatform 320 * @form 321 * @atomicservice 322 * @since arkts {'1.1':'11','1.2':'20'} 323 * @arkts 1.1&1.2 324 */ 325declare class ImageAnimatorAttribute extends CommonMethod<ImageAnimatorAttribute> { 326 /** 327 * list images 328 * 329 * @param { Array<ImageFrameInfo> } value 330 * @returns { ImageAnimatorAttribute } 331 * @syscap SystemCapability.ArkUI.ArkUI.Full 332 * @since 7 333 */ 334 /** 335 * list images 336 * 337 * @param { Array<ImageFrameInfo> } value 338 * @returns { ImageAnimatorAttribute } 339 * @syscap SystemCapability.ArkUI.ArkUI.Full 340 * @crossplatform 341 * @form 342 * @since 10 343 */ 344 /** 345 * Sets the image frame information. 346 * 347 * <p><strong>NOTE</strong>: 348 * <br>Dynamic update is not supported. 349 * </p> 350 * 351 * @param { Array<ImageFrameInfo> } value - Image frame informatio, Default value is []. 352 * @returns { ImageAnimatorAttribute } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @form 356 * @atomicservice 357 * @since arkts {'1.1':'11','1.2':'20'} 358 * @arkts 1.1&1.2 359 */ 360 images(value: Array<ImageFrameInfo>): ImageAnimatorAttribute; 361 362 /** 363 * The default value is the initial state, which is used to control the playback status. 364 * 365 * @param { AnimationStatus } value 366 * @returns { ImageAnimatorAttribute } 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @since 7 369 */ 370 /** 371 * The default value is the initial state, which is used to control the playback status. 372 * 373 * @param { AnimationStatus } value 374 * @returns { ImageAnimatorAttribute } 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @form 378 * @since 10 379 */ 380 /** 381 * Sets the playback state of the animation. 382 * 383 * @param { AnimationStatus } value - Playback state of the animation, Default value is AnimationStatus.Initial. 384 * @returns { ImageAnimatorAttribute } 385 * @syscap SystemCapability.ArkUI.ArkUI.Full 386 * @crossplatform 387 * @form 388 * @atomicservice 389 * @since arkts {'1.1':'11','1.2':'20'} 390 * @arkts 1.1&1.2 391 */ 392 state(value: AnimationStatus): ImageAnimatorAttribute; 393 394 /** 395 * The unit is millisecond. 396 * 397 * @param { number } value 398 * @returns { ImageAnimatorAttribute } 399 * @syscap SystemCapability.ArkUI.ArkUI.Full 400 * @since 7 401 */ 402 /** 403 * The unit is millisecond. 404 * 405 * @param { number } value 406 * @returns { ImageAnimatorAttribute } 407 * @syscap SystemCapability.ArkUI.ArkUI.Full 408 * @crossplatform 409 * @form 410 * @since 10 411 */ 412 /** 413 * Sets the playback duration. 414 * The unit is millisecond. 415 * 416 * <p><strong>NOTE</strong>: 417 * <br>This attribute does not take effect when a separate duration is set for any of the image frames. 418 * </p> 419 * 420 * @param { number } value - Playback duration, Default value is 1000. 421 * @returns { ImageAnimatorAttribute } 422 * @syscap SystemCapability.ArkUI.ArkUI.Full 423 * @crossplatform 424 * @form 425 * @atomicservice 426 * @since arkts {'1.1':'11','1.2':'20'} 427 * @arkts 1.1&1.2 428 */ 429 duration(value: number): ImageAnimatorAttribute; 430 431 /** 432 * Set the playback sequence. 433 * 434 * @param { boolean } value 435 * @returns { ImageAnimatorAttribute } 436 * @syscap SystemCapability.ArkUI.ArkUI.Full 437 * @since 7 438 */ 439 /** 440 * Set the playback sequence. 441 * 442 * @param { boolean } value 443 * @returns { ImageAnimatorAttribute } 444 * @syscap SystemCapability.ArkUI.ArkUI.Full 445 * @crossplatform 446 * @form 447 * @since 10 448 */ 449 /** 450 * Sets the playback direction. 451 * 452 * @param { boolean } value - Playback direction, Default value is false. 453 * @returns { ImageAnimatorAttribute } 454 * @syscap SystemCapability.ArkUI.ArkUI.Full 455 * @crossplatform 456 * @form 457 * @atomicservice 458 * @since arkts {'1.1':'11','1.2':'20'} 459 * @arkts 1.1&1.2 460 */ 461 reverse(value: boolean): ImageAnimatorAttribute; 462 463 /** 464 * Sets whether the image size is fixed to the component size. 465 * 466 * @param { boolean } value 467 * @returns { ImageAnimatorAttribute } 468 * @syscap SystemCapability.ArkUI.ArkUI.Full 469 * @since 7 470 */ 471 /** 472 * Sets whether the image size is fixed to the component size. 473 * 474 * @param { boolean } value 475 * @returns { ImageAnimatorAttribute } 476 * @syscap SystemCapability.ArkUI.ArkUI.Full 477 * @crossplatform 478 * @form 479 * @since 10 480 */ 481 /** 482 * Sets whether the image size is fixed at the component size. 483 * 484 * @param { boolean } value - Whether the image size is fixed at the component size, Default value is true. 485 * @returns { ImageAnimatorAttribute } 486 * @syscap SystemCapability.ArkUI.ArkUI.Full 487 * @crossplatform 488 * @form 489 * @atomicservice 490 * @since arkts {'1.1':'11','1.2':'20'} 491 * @arkts 1.1&1.2 492 */ 493 fixedSize(value: boolean): ImageAnimatorAttribute; 494 495 /** 496 * Sets the number of images to be pre-decoded. 497 * 498 * @param { number } value - Number of images to be pre-decoded, Default value is 0. 499 * @returns { ImageAnimatorAttribute } 500 * @syscap SystemCapability.ArkUI.ArkUI.Full 501 * @since 7 502 * @deprecated since 9 503 */ 504 preDecode(value: number): ImageAnimatorAttribute; 505 506 /** 507 * Sets the state before and after the animation starts 508 * 509 * @param { FillMode } value 510 * @returns { ImageAnimatorAttribute } 511 * @syscap SystemCapability.ArkUI.ArkUI.Full 512 * @since 7 513 */ 514 /** 515 * Sets the state before and after the animation starts 516 * 517 * @param { FillMode } value 518 * @returns { ImageAnimatorAttribute } 519 * @syscap SystemCapability.ArkUI.ArkUI.Full 520 * @crossplatform 521 * @form 522 * @since 10 523 */ 524 /** 525 * Sets the status before and after execution of the animation in the current playback direction. 526 * 527 * @param { FillMode } value - Status before and after execution of the animation in the current playback direction, 528 * Default value is FillMode.Forwards. 529 * @returns { ImageAnimatorAttribute } 530 * @syscap SystemCapability.ArkUI.ArkUI.Full 531 * @crossplatform 532 * @form 533 * @atomicservice 534 * @since arkts {'1.1':'11','1.2':'20'} 535 * @arkts 1.1&1.2 536 */ 537 fillMode(value: FillMode): ImageAnimatorAttribute; 538 539 /** 540 * Played once by default 541 * 542 * @param { number } value 543 * @returns { ImageAnimatorAttribute } 544 * @syscap SystemCapability.ArkUI.ArkUI.Full 545 * @since 7 546 */ 547 /** 548 * Played once by default 549 * 550 * @param { number } value 551 * @returns { ImageAnimatorAttribute } 552 * @syscap SystemCapability.ArkUI.ArkUI.Full 553 * @crossplatform 554 * @since 10 555 */ 556 /** 557 * Sets the number of times that the animation is played. 558 * Played once by default 559 * 560 * @param { number } value - Number of times that the animation is played, Default value is 1. 561 * @returns { ImageAnimatorAttribute } 562 * @syscap SystemCapability.ArkUI.ArkUI.Full 563 * @crossplatform 564 * @atomicservice 565 * @since arkts {'1.1':'11','1.2':'20'} 566 * @arkts 1.1&1.2 567 */ 568 iterations(value: number): ImageAnimatorAttribute; 569 570 /** 571 * Sets whether the component should automatically pause or resume based on its visibility, using the system's 572 * onVisibleAreaChange event. 573 * 574 * @param { boolean } monitorInvisibleArea - Whether the component should automatically pause or resume based on 575 * its visibility, using the system's onVisibleAreaChange event, Default value is false. 576 * @returns { ImageAnimatorAttribute } 577 * @default false 578 * @syscap SystemCapability.ArkUI.ArkUI.Full 579 * @crossplatform 580 * @atomicservice 581 * @since arkts {'1.1':'17','1.2':'20'} 582 * @arkts 1.1&1.2 583 */ 584 monitorInvisibleArea(monitorInvisibleArea: boolean) : ImageAnimatorAttribute; 585 586 /** 587 * Status callback, which is triggered when the animation starts to play. 588 * 589 * @param { function } event 590 * @returns { ImageAnimatorAttribute } 591 * @syscap SystemCapability.ArkUI.ArkUI.Full 592 * @since 7 593 */ 594 /** 595 * Status callback, which is triggered when the animation starts to play. 596 * 597 * @param { function } event 598 * @returns { ImageAnimatorAttribute } 599 * @syscap SystemCapability.ArkUI.ArkUI.Full 600 * @crossplatform 601 * @form 602 * @since 10 603 */ 604 /** 605 * Status callback, which is triggered when the animation starts to play. 606 * 607 * @param { function } event 608 * @returns { ImageAnimatorAttribute } 609 * @syscap SystemCapability.ArkUI.ArkUI.Full 610 * @crossplatform 611 * @form 612 * @atomicservice 613 * @since arkts {'1.1':'11','1.2':'20'} 614 * @arkts 1.1&1.2 615 */ 616 onStart(event: () => void): ImageAnimatorAttribute; 617 618 /** 619 * Status callback, which is triggered when the animation pauses. 620 * 621 * @param { function } event 622 * @returns { ImageAnimatorAttribute } 623 * @syscap SystemCapability.ArkUI.ArkUI.Full 624 * @since 7 625 */ 626 /** 627 * Status callback, which is triggered when the animation pauses. 628 * 629 * @param { function } event 630 * @returns { ImageAnimatorAttribute } 631 * @syscap SystemCapability.ArkUI.ArkUI.Full 632 * @crossplatform 633 * @form 634 * @since 10 635 */ 636 /** 637 * Status callback, which is triggered when the animation pauses. 638 * 639 * @param { function } event 640 * @returns { ImageAnimatorAttribute } 641 * @syscap SystemCapability.ArkUI.ArkUI.Full 642 * @crossplatform 643 * @form 644 * @atomicservice 645 * @since arkts {'1.1':'11','1.2':'20'} 646 * @arkts 1.1&1.2 647 */ 648 onPause(event: () => void): ImageAnimatorAttribute; 649 650 /** 651 * Status callback, triggered when the animation is replayed 652 * 653 * @param { function } event 654 * @returns { ImageAnimatorAttribute } 655 * @syscap SystemCapability.ArkUI.ArkUI.Full 656 * @since 7 657 */ 658 /** 659 * Status callback, triggered when the animation is replayed 660 * 661 * @param { function } event 662 * @returns { ImageAnimatorAttribute } 663 * @syscap SystemCapability.ArkUI.ArkUI.Full 664 * @crossplatform 665 * @since 10 666 */ 667 /** 668 * Status callback, triggered when the animation is replayed 669 * 670 * @param { function } event 671 * @returns { ImageAnimatorAttribute } 672 * @syscap SystemCapability.ArkUI.ArkUI.Full 673 * @crossplatform 674 * @atomicservice 675 * @since arkts {'1.1':'11','1.2':'20'} 676 * @arkts 1.1&1.2 677 */ 678 onRepeat(event: () => void): ImageAnimatorAttribute; 679 680 /** 681 * Status callback, which is triggered when the animation is canceled. 682 * 683 * @param { function } event 684 * @returns { ImageAnimatorAttribute } 685 * @syscap SystemCapability.ArkUI.ArkUI.Full 686 * @since 7 687 */ 688 /** 689 * Status callback, which is triggered when the animation is canceled. 690 * 691 * @param { function } event 692 * @returns { ImageAnimatorAttribute } 693 * @syscap SystemCapability.ArkUI.ArkUI.Full 694 * @crossplatform 695 * @form 696 * @since 10 697 */ 698 /** 699 * Status callback, which is triggered when the animation playback returns to the initial state. 700 * 701 * @param { function } event 702 * @returns { ImageAnimatorAttribute } 703 * @syscap SystemCapability.ArkUI.ArkUI.Full 704 * @crossplatform 705 * @form 706 * @atomicservice 707 * @since arkts {'1.1':'11','1.2':'20'} 708 * @arkts 1.1&1.2 709 */ 710 onCancel(event: () => void): ImageAnimatorAttribute; 711 712 /** 713 * Status callback, which is triggered when the animation playback is complete. 714 * 715 * @param { function } event 716 * @returns { ImageAnimatorAttribute } 717 * @syscap SystemCapability.ArkUI.ArkUI.Full 718 * @since 7 719 */ 720 /** 721 * Status callback, which is triggered when the animation playback is complete. 722 * 723 * @param { function } event 724 * @returns { ImageAnimatorAttribute } 725 * @syscap SystemCapability.ArkUI.ArkUI.Full 726 * @crossplatform 727 * @form 728 * @since 10 729 */ 730 /** 731 * Status callback, which is triggered when the animation playback is complete or stopped. 732 * 733 * @param { function } event 734 * @returns { ImageAnimatorAttribute } 735 * @syscap SystemCapability.ArkUI.ArkUI.Full 736 * @crossplatform 737 * @form 738 * @atomicservice 739 * @since arkts {'1.1':'11','1.2':'20'} 740 * @arkts 1.1&1.2 741 */ 742 onFinish(event: () => void): ImageAnimatorAttribute; 743} 744 745/** 746 * Defines ImageAnimator Component. 747 * 748 * @syscap SystemCapability.ArkUI.ArkUI.Full 749 * @since 7 750 */ 751/** 752 * Defines ImageAnimator Component. 753 * 754 * @syscap SystemCapability.ArkUI.ArkUI.Full 755 * @crossplatform 756 * @form 757 * @since 10 758 */ 759/** 760 * Defines ImageAnimator Component. 761 * 762 * @syscap SystemCapability.ArkUI.ArkUI.Full 763 * @crossplatform 764 * @form 765 * @atomicservice 766 * @since 11 767 */ 768declare const ImageAnimator: ImageAnimatorInterface; 769 770/** 771 * Defines ImageAnimator Component instance. 772 * 773 * @syscap SystemCapability.ArkUI.ArkUI.Full 774 * @since 7 775 */ 776/** 777 * Defines ImageAnimator Component instance. 778 * 779 * @syscap SystemCapability.ArkUI.ArkUI.Full 780 * @crossplatform 781 * @form 782 * @since 10 783 */ 784/** 785 * Defines ImageAnimator Component instance. 786 * 787 * @syscap SystemCapability.ArkUI.ArkUI.Full 788 * @crossplatform 789 * @form 790 * @atomicservice 791 * @since 11 792 */ 793declare const ImageAnimatorInstance: ImageAnimatorAttribute; 794