1/* 2 * Copyright (c) 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/** 22 * Defines the ParticleOptions Interface. 23 * @interface ParticleOptions 24 * @syscap SystemCapability.ArkUI.ArkUI.Full 25 * @crossplatform 26 * @since 10 27 */ 28/** 29 * Defines the ParticleOptions Interface. 30 * @interface ParticleOptions 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @crossplatform 33 * @atomicservice 34 * @since 11 35 */ 36interface ParticleOptions< 37 PARTICLE extends ParticleType, 38 COLOR_UPDATER extends ParticleUpdater, 39 OPACITY_UPDATER extends ParticleUpdater, 40 SCALE_UPDATER extends ParticleUpdater, 41 ACC_SPEED_UPDATER extends ParticleUpdater, 42 ACC_ANGLE_UPDATER extends ParticleUpdater, 43 SPIN_UPDATER extends ParticleUpdater 44> { 45 /** 46 * Particle emitter. 47 * @type { EmitterOptions<PARTICLE> } 48 * @syscap SystemCapability.ArkUI.ArkUI.Full 49 * @crossplatform 50 * @since 10 51 */ 52 /** 53 * Particle emitter. 54 * @type { EmitterOptions<PARTICLE> } 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @crossplatform 57 * @atomicservice 58 * @since 11 59 */ 60 emitter: EmitterOptions<PARTICLE>; 61 62 /** 63 * Particle color. 64 * @type { ?ParticleColorPropertyOptions<COLOR_UPDATER> } 65 * @default {range:['#FFFFFF','#FFFFFF']} 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @crossplatform 68 * @since 10 69 */ 70 /** 71 * Particle color. 72 * @type { ?ParticleColorPropertyOptions<COLOR_UPDATER> } 73 * @default {range:['#FFFFFF','#FFFFFF']} 74 * @syscap SystemCapability.ArkUI.ArkUI.Full 75 * @crossplatform 76 * @atomicservice 77 * @since 11 78 */ 79 color?: ParticleColorPropertyOptions<COLOR_UPDATER>; 80 81 /** 82 * Particle opacity. 83 * @type { ?ParticlePropertyOptions<number, OPACITY_UPDATER> } 84 * @default {range:[1.0,1.0]} 85 * @syscap SystemCapability.ArkUI.ArkUI.Full 86 * @crossplatform 87 * @since 10 88 */ 89 /** 90 * Particle opacity. 91 * @type { ?ParticlePropertyOptions<number, OPACITY_UPDATER> } 92 * @default {range:[1.0,1.0]} 93 * @syscap SystemCapability.ArkUI.ArkUI.Full 94 * @crossplatform 95 * @atomicservice 96 * @since 11 97 */ 98 opacity?: ParticlePropertyOptions<number, OPACITY_UPDATER>; 99 100 /** 101 * Particle scale. 102 * @type { ?ParticlePropertyOptions<number, SCALE_UPDATER> } 103 * @default {range:[1.0,1.0]} 104 * @syscap SystemCapability.ArkUI.ArkUI.Full 105 * @crossplatform 106 * @since 10 107 */ 108 /** 109 * Particle scale. 110 * @type { ?ParticlePropertyOptions<number, SCALE_UPDATER> } 111 * @default {range:[1.0,1.0]} 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @crossplatform 114 * @atomicservice 115 * @since 11 116 */ 117 scale?: ParticlePropertyOptions<number, SCALE_UPDATER>; 118 119 /** 120 * Particle velocity. 121 * @type { ?object } 122 * @default {speed:[0,0];angle:[0,0]} 123 * @syscap SystemCapability.ArkUI.ArkUI.Full 124 * @crossplatform 125 * @since 10 126 */ 127 /** 128 * Particle velocity. 129 * @type { ?object } 130 * @default {speed:[0,0];angle:[0,0]} 131 * @syscap SystemCapability.ArkUI.ArkUI.Full 132 * @crossplatform 133 * @atomicservice 134 * @since 11 135 */ 136 velocity?: { 137 speed: [number, number]; 138 angle: [number, number]; 139 }; 140 141 /** 142 * Particle acceleration. 143 * @type { ?object } 144 * @default {speed:{range:[0,0]};angle:{range:[0,0]}} 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @crossplatform 147 * @since 10 148 */ 149 /** 150 * Particle acceleration. 151 * @type { ?object } 152 * @default {speed:{range:[0,0]};angle:{range:[0,0]}} 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @crossplatform 155 * @atomicservice 156 * @since 11 157 */ 158 acceleration?: { 159 speed?: ParticlePropertyOptions<number, ACC_SPEED_UPDATER>; 160 angle?: ParticlePropertyOptions<number, ACC_ANGLE_UPDATER>; 161 }; 162 163 /** 164 * Particle spin. 165 * @type { ?ParticlePropertyOptions<number, SPIN_UPDATER> } 166 * @default {range:[0,0]} 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @crossplatform 169 * @since 10 170 */ 171 /** 172 * Particle spin. 173 * @type { ?ParticlePropertyOptions<number, SPIN_UPDATER> } 174 * @default {range:[0,0]} 175 * @syscap SystemCapability.ArkUI.ArkUI.Full 176 * @crossplatform 177 * @atomicservice 178 * @since 11 179 */ 180 spin?: ParticlePropertyOptions<number, SPIN_UPDATER>; 181} 182 183/** 184 * Defines the parameters for a point-like particle. 185 * @interface PointParticleParameters 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @since 10 189 */ 190/** 191 * Defines the parameters for a point-like particle. 192 * @interface PointParticleParameters 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @crossplatform 195 * @atomicservice 196 * @since 11 197 */ 198interface PointParticleParameters { 199 /** 200 * Particle radius. 201 * @type { VP } 202 * @syscap SystemCapability.ArkUI.ArkUI.Full 203 * @crossplatform 204 * @since 10 205 */ 206 /** 207 * Particle radius. 208 * @type { VP } 209 * @syscap SystemCapability.ArkUI.ArkUI.Full 210 * @crossplatform 211 * @atomicservice 212 * @since 11 213 */ 214 radius: VP; 215} 216 217/** 218 * Defines the parameters for an image-like particle. 219 * @interface ImageParticleParameters 220 * @syscap SystemCapability.ArkUI.ArkUI.Full 221 * @crossplatform 222 * @since 10 223 */ 224/** 225 * Defines the parameters for an image-like particle. 226 * @interface ImageParticleParameters 227 * @syscap SystemCapability.ArkUI.ArkUI.Full 228 * @crossplatform 229 * @atomicservice 230 * @since 11 231 */ 232interface ImageParticleParameters { 233 /** 234 * Particle image pixelMap. 235 * @type { ResourceStr } 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @since 10 239 */ 240 /** 241 * Particle image pixelMap. 242 * @type { ResourceStr } 243 * @syscap SystemCapability.ArkUI.ArkUI.Full 244 * @crossplatform 245 * @atomicservice 246 * @since 11 247 */ 248 src: ResourceStr; 249 250 /** 251 * Particle image size. 252 * @type { [Dimension, Dimension] } 253 * @syscap SystemCapability.ArkUI.ArkUI.Full 254 * @crossplatform 255 * @since 10 256 */ 257 /** 258 * Particle image size. 259 * @type { [Dimension, Dimension] } 260 * @syscap SystemCapability.ArkUI.ArkUI.Full 261 * @crossplatform 262 * @atomicservice 263 * @since 11 264 */ 265 size: [Dimension, Dimension]; 266 267 /** 268 * Image fit. 269 * @type { ?ImageFit } 270 * @default ImageFit.Cover 271 * @syscap SystemCapability.ArkUI.ArkUI.Full 272 * @crossplatform 273 * @since 10 274 */ 275 /** 276 * Image fit. 277 * @type { ?ImageFit } 278 * @default ImageFit.Cover 279 * @syscap SystemCapability.ArkUI.ArkUI.Full 280 * @crossplatform 281 * @atomicservice 282 * @since 11 283 */ 284 objectFit?: ImageFit; 285} 286 287/** 288 * Defines the particle configs. 289 * @interface ParticleConfigs 290 * @syscap SystemCapability.ArkUI.ArkUI.Full 291 * @crossplatform 292 * @since 10 293 */ 294/** 295 * Defines the particle configs. 296 * @interface ParticleConfigs 297 * @syscap SystemCapability.ArkUI.ArkUI.Full 298 * @crossplatform 299 * @atomicservice 300 * @since 11 301 */ 302interface ParticleConfigs { 303 /** 304 * Point-like Particle. 305 * @type { PointParticleParameters } 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @since 10 309 */ 310 /** 311 * Point-like Particle. 312 * @type { PointParticleParameters } 313 * @syscap SystemCapability.ArkUI.ArkUI.Full 314 * @crossplatform 315 * @atomicservice 316 * @since 11 317 */ 318 [ParticleType.POINT]: PointParticleParameters; 319 320 /** 321 * Image-like Particle. 322 * @type { ImageParticleParameters } 323 * @syscap SystemCapability.ArkUI.ArkUI.Full 324 * @crossplatform 325 * @since 10 326 */ 327 /** 328 * Image-like Particle. 329 * @type { ImageParticleParameters } 330 * @syscap SystemCapability.ArkUI.ArkUI.Full 331 * @crossplatform 332 * @atomicservice 333 * @since 11 334 */ 335 [ParticleType.IMAGE]: ImageParticleParameters; 336} 337 338/** 339 * Defines the emitter property. 340 * 341 * @interface EmitterProperty 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @crossplatform 344 * @atomicservice 345 * @since 12 346 */ 347interface EmitterProperty { 348 349 /** 350 * Emitter index. 351 * 352 * @type { number } 353 * @syscap SystemCapability.ArkUI.ArkUI.Full 354 * @crossplatform 355 * @atomicservice 356 * @since 12 357 */ 358 index: number; 359 360 /** 361 * Emitter emission rate. 362 * 363 * @type { ?number } 364 * @syscap SystemCapability.ArkUI.ArkUI.Full 365 * @crossplatform 366 * @atomicservice 367 * @since 12 368 */ 369 emitRate?: number; 370 371 /** 372 * Emitter emission rate. Only support number type. 373 * 374 * @type { ?PositionT<number> } 375 * @syscap SystemCapability.ArkUI.ArkUI.Full 376 * @crossplatform 377 * @atomicservice 378 * @since 12 379 */ 380 position?: PositionT<number>; 381 382 /** 383 * Emitter emission window size. Only support number type. 384 * 385 * @type { ?SizeT<number> } 386 * @syscap SystemCapability.ArkUI.ArkUI.Full 387 * @crossplatform 388 * @atomicservice 389 * @since 12 390 */ 391 size?: SizeT<number>; 392} 393 394/** 395 * Defines the emitter Options. 396 * @interface EmitterOptions 397 * @syscap SystemCapability.ArkUI.ArkUI.Full 398 * @crossplatform 399 * @since 10 400 */ 401/** 402 * Defines the emitter Options. 403 * @interface EmitterOptions 404 * @syscap SystemCapability.ArkUI.ArkUI.Full 405 * @crossplatform 406 * @atomicservice 407 * @since 11 408 */ 409interface EmitterOptions<PARTICLE extends ParticleType> { 410 /** 411 * Set particle config. 412 * @type { object } 413 * @syscap SystemCapability.ArkUI.ArkUI.Full 414 * @crossplatform 415 * @since 10 416 */ 417 /** 418 * Set particle config. 419 * @type { object } 420 * @syscap SystemCapability.ArkUI.ArkUI.Full 421 * @crossplatform 422 * @atomicservice 423 * @since 11 424 */ 425 particle: { 426 /** 427 * Particle type. 428 * @type { PARTICLE } 429 * @syscap SystemCapability.ArkUI.ArkUI.Full 430 * @crossplatform 431 * @since 10 432 */ 433 /** 434 * Particle type. 435 * @type { PARTICLE } 436 * @syscap SystemCapability.ArkUI.ArkUI.Full 437 * @crossplatform 438 * @atomicservice 439 * @since 11 440 */ 441 type: PARTICLE; 442 /** 443 * Particle config. 444 * @type { ParticleConfigs[PARTICLE] } 445 * @syscap SystemCapability.ArkUI.ArkUI.Full 446 * @crossplatform 447 * @since 10 448 */ 449 /** 450 * Particle config. 451 * @type { ParticleConfigs[PARTICLE] } 452 * @syscap SystemCapability.ArkUI.ArkUI.Full 453 * @crossplatform 454 * @atomicservice 455 * @since 11 456 */ 457 config: ParticleConfigs[PARTICLE]; 458 459 /** 460 * Particle count. 461 * @type { number } 462 * @syscap SystemCapability.ArkUI.ArkUI.Full 463 * @crossplatform 464 * @since 10 465 */ 466 /** 467 * Particle count. 468 * @type { number } 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @crossplatform 471 * @atomicservice 472 * @since 11 473 */ 474 count: number; 475 476 /** 477 * Particle lifetime. 478 * @type { ?number } 479 * @default 1000 480 * @syscap SystemCapability.ArkUI.ArkUI.Full 481 * @crossplatform 482 * @since 10 483 */ 484 /** 485 * Particle lifetime. 486 * @type { ?number } 487 * @default 1000 488 * @syscap SystemCapability.ArkUI.ArkUI.Full 489 * @crossplatform 490 * @atomicservice 491 * @since 11 492 */ 493 lifetime?: number; 494 495 /** 496 * Particle lifetimeRange,value range [0, ∞). 497 * when lifetimeRange>lifetime,minimum lifetime is 0. 498 * @type { ?number } 499 * @default 0 500 * @syscap SystemCapability.ArkUI.ArkUI.Full 501 * @crossplatform 502 * @atomicservice 503 * @since 12 504 */ 505 lifetimeRange?: number; 506 }; 507 508 /** 509 * Emitting rate, that is, the number of particles produced per second. 510 * @type { ?number } 511 * @default 5 512 * @syscap SystemCapability.ArkUI.ArkUI.Full 513 * @crossplatform 514 * @since 10 515 */ 516 /** 517 * Emitting rate, that is, the number of particles produced per second. 518 * @type { ?number } 519 * @default 5 520 * @syscap SystemCapability.ArkUI.ArkUI.Full 521 * @crossplatform 522 * @atomicservice 523 * @since 11 524 */ 525 emitRate?: number; 526 527 /** 528 * Shape of emitter. 529 * @type { ?ParticleEmitterShape } 530 * @default ParticleEmitterShape.RECTANGLE 531 * @syscap SystemCapability.ArkUI.ArkUI.Full 532 * @crossplatform 533 * @since 10 534 */ 535 /** 536 * Shape of emitter. 537 * @type { ?ParticleEmitterShape } 538 * @default ParticleEmitterShape.RECTANGLE 539 * @syscap SystemCapability.ArkUI.ArkUI.Full 540 * @crossplatform 541 * @atomicservice 542 * @since 11 543 */ 544 shape?: ParticleEmitterShape; 545 546 /** 547 * Position of emitter. 548 * The first element means X-axis location. 549 * The second element means the Y-axis location. 550 * @type { ?[Dimension, Dimension] } 551 * @default [0,0] 552 * @syscap SystemCapability.ArkUI.ArkUI.Full 553 * @crossplatform 554 * @since 10 555 */ 556 /** 557 * Position of emitter. 558 * The first element means X-axis location. 559 * The second element means the Y-axis location. 560 * @type { ?[Dimension, Dimension] } 561 * @default [0,0] 562 * @syscap SystemCapability.ArkUI.ArkUI.Full 563 * @crossplatform 564 * @atomicservice 565 * @since 11 566 */ 567 position?: [Dimension, Dimension]; 568 569 /** 570 * Size of emitter. 571 * The first element means emitter width. 572 * The second element means emitter height. 573 * @type { ?[Dimension, Dimension] } 574 * @default ['100%','100%'] 575 * @syscap SystemCapability.ArkUI.ArkUI.Full 576 * @crossplatform 577 * @since 10 578 */ 579 /** 580 * Size of emitter. 581 * The first element means emitter width. 582 * The second element means emitter height. 583 * @type { ?[Dimension, Dimension] } 584 * @default ['100%','100%'] 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @crossplatform 587 * @atomicservice 588 * @since 11 589 */ 590 size?: [Dimension, Dimension]; 591} 592 593/** 594 * Defines the particle property updater configs. 595 * @interface ParticlePropertyUpdaterConfigs 596 * @syscap SystemCapability.ArkUI.ArkUI.Full 597 * @crossplatform 598 * @since 10 599 */ 600/** 601 * Defines the particle property updater configs. 602 * @interface ParticlePropertyUpdaterConfigs 603 * @syscap SystemCapability.ArkUI.ArkUI.Full 604 * @crossplatform 605 * @atomicservice 606 * @since 11 607 */ 608interface ParticlePropertyUpdaterConfigs<T> { 609 /** 610 * No effect of particle updater. 611 * 612 * @type { void } 613 * @syscap SystemCapability.ArkUI.ArkUI.Full 614 * @crossplatform 615 * @since 10 616 */ 617 /** 618 * No effect of particle updater. 619 * 620 * @type { void } 621 * @syscap SystemCapability.ArkUI.ArkUI.Full 622 * @crossplatform 623 * @atomicservice 624 * @since 11 625 */ 626 [ParticleUpdater.NONE]: void; 627 628 /** 629 * Random effect of particle updater. 630 * @type { [T, T] } 631 * @syscap SystemCapability.ArkUI.ArkUI.Full 632 * @crossplatform 633 * @since 10 634 */ 635 /** 636 * Random effect of particle updater. 637 * @type { [T, T] } 638 * @syscap SystemCapability.ArkUI.ArkUI.Full 639 * @crossplatform 640 * @atomicservice 641 * @since 11 642 */ 643 [ParticleUpdater.RANDOM]: [T, T]; 644 645 /** 646 * Curve effect of particle updater. 647 * @type { Array<ParticlePropertyAnimation<T>> } 648 * @syscap SystemCapability.ArkUI.ArkUI.Full 649 * @crossplatform 650 * @since 10 651 */ 652 /** 653 * Curve effect of particle updater. 654 * @type { Array<ParticlePropertyAnimation<T>> } 655 * @syscap SystemCapability.ArkUI.ArkUI.Full 656 * @crossplatform 657 * @atomicservice 658 * @since 11 659 */ 660 [ParticleUpdater.CURVE]: Array<ParticlePropertyAnimation<T>>; 661} 662 663/** 664 * Defines the particle property Options. 665 * @interface ParticlePropertyOptions 666 * @syscap SystemCapability.ArkUI.ArkUI.Full 667 * @crossplatform 668 * @since 10 669 */ 670/** 671 * Defines the particle property Options. 672 * @interface ParticlePropertyOptions 673 * @syscap SystemCapability.ArkUI.ArkUI.Full 674 * @crossplatform 675 * @atomicservice 676 * @since 11 677 */ 678interface ParticlePropertyOptions<TYPE, UPDATER extends ParticleUpdater> { 679 /** 680 * Initial range, within which the initial value are randomly generated. 681 * @type { [TYPE, TYPE] } 682 * @syscap SystemCapability.ArkUI.ArkUI.Full 683 * @crossplatform 684 * @since 10 685 */ 686 /** 687 * Initial range, within which the initial value are randomly generated. 688 * @type { [TYPE, TYPE] } 689 * @syscap SystemCapability.ArkUI.ArkUI.Full 690 * @crossplatform 691 * @atomicservice 692 * @since 11 693 */ 694 range: [TYPE, TYPE]; 695 696 /** 697 * Particle property updater. 698 * @type { ?object } 699 * @default {type:UPDATER.NONE;config:ParticlePropertyUpdaterConfigs<UPDATER.NONE>[UPDATER.NONE]} 700 * @syscap SystemCapability.ArkUI.ArkUI.Full 701 * @crossplatform 702 * @since 10 703 */ 704 /** 705 * Particle property updater. 706 * @type { ?object } 707 * @default {type:UPDATER.NONE;config:ParticlePropertyUpdaterConfigs<UPDATER.NONE>[UPDATER.NONE]} 708 * @syscap SystemCapability.ArkUI.ArkUI.Full 709 * @crossplatform 710 * @atomicservice 711 * @since 11 712 */ 713 updater?: { 714 type: UPDATER; 715 config: ParticlePropertyUpdaterConfigs<TYPE>[UPDATER]; 716 }; 717} 718 719/** 720 * Defines the particle color property updater configs. 721 * @interface ParticleColorPropertyUpdaterConfigs 722 * @syscap SystemCapability.ArkUI.ArkUI.Full 723 * @crossplatform 724 * @since 10 725 */ 726/** 727 * Defines the particle color property updater configs. 728 * @interface ParticleColorPropertyUpdaterConfigs 729 * @syscap SystemCapability.ArkUI.ArkUI.Full 730 * @crossplatform 731 * @atomicservice 732 * @since 11 733 */ 734interface ParticleColorPropertyUpdaterConfigs { 735 /** 736 * No effect of particle color property updater. 737 * 738 * @type { void } 739 * @syscap SystemCapability.ArkUI.ArkUI.Full 740 * @crossplatform 741 * @since 10 742 */ 743 /** 744 * No effect of particle color property updater. 745 * 746 * @type { void } 747 * @syscap SystemCapability.ArkUI.ArkUI.Full 748 * @crossplatform 749 * @atomicservice 750 * @since 11 751 */ 752 [ParticleUpdater.NONE]: void; 753 754 /** 755 * Random effect of particle color property updater. 756 * @type { object } 757 * @syscap SystemCapability.ArkUI.ArkUI.Full 758 * @crossplatform 759 * @since 10 760 */ 761 /** 762 * Random effect of particle color property updater. 763 * @type { object } 764 * @syscap SystemCapability.ArkUI.ArkUI.Full 765 * @crossplatform 766 * @atomicservice 767 * @since 11 768 */ 769 [ParticleUpdater.RANDOM]: { 770 r: [number, number]; 771 g: [number, number]; 772 b: [number, number]; 773 a: [number, number]; 774 }; 775 776 /** 777 * Curve effect of particle color property updater. 778 * 779 * @type { Array<ParticlePropertyAnimation<ResourceColor>> } 780 * @syscap SystemCapability.ArkUI.ArkUI.Full 781 * @crossplatform 782 * @since 10 783 */ 784 /** 785 * Curve effect of particle color property updater. 786 * 787 * @type { Array<ParticlePropertyAnimation<ResourceColor>> } 788 * @syscap SystemCapability.ArkUI.ArkUI.Full 789 * @crossplatform 790 * @atomicservice 791 * @since 11 792 */ 793 [ParticleUpdater.CURVE]: Array<ParticlePropertyAnimation<ResourceColor>>; 794} 795 796/** 797 * Defines the particle color property updater configs which can support generics. 798 * @interface ParticleColorPropertyOptions 799 * @syscap SystemCapability.ArkUI.ArkUI.Full 800 * @crossplatform 801 * @since 10 802 */ 803/** 804 * Defines the particle color property updater configs which can support generics. 805 * @interface ParticleColorPropertyOptions 806 * @syscap SystemCapability.ArkUI.ArkUI.Full 807 * @crossplatform 808 * @atomicservice 809 * @since 11 810 */ 811interface ParticleColorPropertyOptions<UPDATER extends ParticleUpdater> { 812 /** 813 * Initial color range, within which the initial color is randomly generated. 814 * @type { [ResourceColor, ResourceColor] } 815 * @syscap SystemCapability.ArkUI.ArkUI.Full 816 * @crossplatform 817 * @since 10 818 */ 819 /** 820 * Initial color range, within which the initial color is randomly generated. 821 * @type { [ResourceColor, ResourceColor] } 822 * @syscap SystemCapability.ArkUI.ArkUI.Full 823 * @crossplatform 824 * @atomicservice 825 * @since 11 826 */ 827 range: [ResourceColor, ResourceColor]; 828 829 /** 830 * Distribution type of particle color. 831 * @type { ?DistributionType } 832 * @default DistributionType.UNIFORM 833 * @syscap SystemCapability.ArkUI.ArkUI.Full 834 * @crossplatform 835 * @atomicservice 836 * @since 12 837 */ 838 distributionType?: DistributionType; 839 840 /** 841 * Particle color property updater. 842 * @type { ?object } 843 * @default {type:UPDATER.NONE;config:ParticleColorPropertyUpdaterConfigs[UPDATER.NONE]} 844 * @syscap SystemCapability.ArkUI.ArkUI.Full 845 * @crossplatform 846 * @since 10 847 */ 848 /** 849 * Particle color property updater. 850 * @type { ?object } 851 * @default {type:UPDATER.NONE;config:ParticleColorPropertyUpdaterConfigs[UPDATER.NONE]} 852 * @syscap SystemCapability.ArkUI.ArkUI.Full 853 * @crossplatform 854 * @atomicservice 855 * @since 11 856 */ 857 updater?: { 858 type: UPDATER; 859 config: ParticleColorPropertyUpdaterConfigs[UPDATER]; 860 }; 861} 862 863/** 864 * Defines the particle property lifecycle. 865 * @interface ParticlePropertyAnimation 866 * @syscap SystemCapability.ArkUI.ArkUI.Full 867 * @crossplatform 868 * @since 10 869 */ 870/** 871 * Defines the particle property lifecycle. 872 * @interface ParticlePropertyAnimation 873 * @syscap SystemCapability.ArkUI.ArkUI.Full 874 * @crossplatform 875 * @atomicservice 876 * @since 11 877 */ 878interface ParticlePropertyAnimation<T> { 879 /** 880 * Start position of the particle animation. 881 * @type { T } 882 * @syscap SystemCapability.ArkUI.ArkUI.Full 883 * @crossplatform 884 * @since 10 885 */ 886 /** 887 * Start position of the particle animation. 888 * @type { T } 889 * @syscap SystemCapability.ArkUI.ArkUI.Full 890 * @crossplatform 891 * @atomicservice 892 * @since 11 893 */ 894 from: T; 895 896 /** 897 * End position of the particle animation. 898 * @type { T } 899 * @syscap SystemCapability.ArkUI.ArkUI.Full 900 * @crossplatform 901 * @since 10 902 */ 903 /** 904 * End position of the particle animation. 905 * @type { T } 906 * @syscap SystemCapability.ArkUI.ArkUI.Full 907 * @crossplatform 908 * @atomicservice 909 * @since 11 910 */ 911 to: T; 912 913 /** 914 * Start millis of the particle animation. 915 * @type { number } 916 * @syscap SystemCapability.ArkUI.ArkUI.Full 917 * @crossplatform 918 * @since 10 919 */ 920 /** 921 * Start millis of the particle animation. 922 * @type { number } 923 * @syscap SystemCapability.ArkUI.ArkUI.Full 924 * @crossplatform 925 * @atomicservice 926 * @since 11 927 */ 928 startMillis: number; 929 930 /** 931 * End millis of the particle animation. 932 * @type { number } 933 * @syscap SystemCapability.ArkUI.ArkUI.Full 934 * @crossplatform 935 * @since 10 936 */ 937 /** 938 * End millis of the particle animation. 939 * @type { number } 940 * @syscap SystemCapability.ArkUI.ArkUI.Full 941 * @crossplatform 942 * @atomicservice 943 * @since 11 944 */ 945 endMillis: number; 946 947 /** 948 * Curve of the particle animation. 949 * @type { ?(Curve | ICurve) } 950 * @default Curve.Linear 951 * @syscap SystemCapability.ArkUI.ArkUI.Full 952 * @crossplatform 953 * @since 10 954 */ 955 /** 956 * Curve of the particle animation. 957 * @type { ?(Curve | ICurve) } 958 * @default Curve.Linear 959 * @syscap SystemCapability.ArkUI.ArkUI.Full 960 * @crossplatform 961 * @atomicservice 962 * @since 11 963 */ 964 curve?: Curve | ICurve; 965} 966 967/** 968 * Defines the particle Interface. 969 * @interface ParticleInterface 970 * @syscap SystemCapability.ArkUI.ArkUI.Full 971 * @crossplatform 972 * @since 10 973 */ 974/** 975 * Defines the particle Interface. 976 * @interface ParticleInterface 977 * @syscap SystemCapability.ArkUI.ArkUI.Full 978 * @crossplatform 979 * @atomicservice 980 * @since 11 981 */ 982interface ParticleInterface { 983 /** 984 * create a particle array. 985 * @param { object } value - Particle value 986 * particles - list of ParticleOptions. 987 * @returns { ParticleAttribute } Returns the particle attribute. 988 * @syscap SystemCapability.ArkUI.ArkUI.Full 989 * @crossplatform 990 * @since 10 991 */ 992 /** 993 * create a particle array. 994 * @param { object } value - Particle value 995 * particles - list of ParticleOptions. 996 * @returns { ParticleAttribute } Returns the particle attribute. 997 * @syscap SystemCapability.ArkUI.ArkUI.Full 998 * @crossplatform 999 * @atomicservice 1000 * @since 11 1001 */ 1002 < 1003 PARTICLE extends ParticleType, 1004 COLOR_UPDATER extends ParticleUpdater, 1005 OPACITY_UPDATER extends ParticleUpdater, 1006 SCALE_UPDATER extends ParticleUpdater, 1007 ACC_SPEED_UPDATER extends ParticleUpdater, 1008 ACC_ANGLE_UPDATER extends ParticleUpdater, 1009 SPIN_UPDATER extends ParticleUpdater 1010 >(value: { 1011 particles: Array< 1012 ParticleOptions< 1013 PARTICLE, 1014 COLOR_UPDATER, 1015 OPACITY_UPDATER, 1016 SCALE_UPDATER, 1017 ACC_SPEED_UPDATER, 1018 ACC_ANGLE_UPDATER, 1019 SPIN_UPDATER 1020 > 1021 >; 1022 }): ParticleAttribute; 1023} 1024 1025/** 1026 * Enumerates the particle types. 1027 * @enum { string } 1028 * @syscap SystemCapability.ArkUI.ArkUI.Full 1029 * @crossplatform 1030 * @since 10 1031 */ 1032/** 1033 * Enumerates the particle types. 1034 * @enum { string } 1035 * @syscap SystemCapability.ArkUI.ArkUI.Full 1036 * @crossplatform 1037 * @atomicservice 1038 * @since 11 1039 */ 1040declare enum ParticleType { 1041 /** 1042 * Point-like particle. 1043 * @syscap SystemCapability.ArkUI.ArkUI.Full 1044 * @crossplatform 1045 * @since 10 1046 */ 1047 /** 1048 * Point-like particle. 1049 * @syscap SystemCapability.ArkUI.ArkUI.Full 1050 * @crossplatform 1051 * @atomicservice 1052 * @since 11 1053 */ 1054 POINT = 'point', 1055 1056 /** 1057 * Image-like particle. 1058 * @syscap SystemCapability.ArkUI.ArkUI.Full 1059 * @crossplatform 1060 * @since 10 1061 */ 1062 /** 1063 * Image-like particle. 1064 * @syscap SystemCapability.ArkUI.ArkUI.Full 1065 * @crossplatform 1066 * @atomicservice 1067 * @since 11 1068 */ 1069 IMAGE = 'image', 1070} 1071 1072/** 1073 * Enumerates the emitter shapes of a particle. 1074 * @enum { string } 1075 * @syscap SystemCapability.ArkUI.ArkUI.Full 1076 * @crossplatform 1077 * @since 10 1078 */ 1079/** 1080 * Enumerates the emitter shapes of a particle. 1081 * @enum { string } 1082 * @syscap SystemCapability.ArkUI.ArkUI.Full 1083 * @crossplatform 1084 * @atomicservice 1085 * @since 11 1086 */ 1087declare enum ParticleEmitterShape { 1088 /** 1089 * Rectangle. 1090 * @syscap SystemCapability.ArkUI.ArkUI.Full 1091 * @crossplatform 1092 * @since 10 1093 */ 1094 /** 1095 * Rectangle. 1096 * @syscap SystemCapability.ArkUI.ArkUI.Full 1097 * @crossplatform 1098 * @atomicservice 1099 * @since 11 1100 */ 1101 RECTANGLE = 'rectangle', 1102 1103 /** 1104 * Circle. 1105 * @syscap SystemCapability.ArkUI.ArkUI.Full 1106 * @crossplatform 1107 * @since 10 1108 */ 1109 /** 1110 * Circle. 1111 * @syscap SystemCapability.ArkUI.ArkUI.Full 1112 * @crossplatform 1113 * @atomicservice 1114 * @since 11 1115 */ 1116 CIRCLE = 'circle', 1117 1118 /** 1119 * Ellipse. 1120 * @syscap SystemCapability.ArkUI.ArkUI.Full 1121 * @crossplatform 1122 * @since 10 1123 */ 1124 /** 1125 * Ellipse. 1126 * @syscap SystemCapability.ArkUI.ArkUI.Full 1127 * @crossplatform 1128 * @atomicservice 1129 * @since 11 1130 */ 1131 ELLIPSE = 'ellipse', 1132} 1133 1134/** 1135 * Enumerates the color distribution types of a particle. 1136 * 1137 * @enum { number } 1138 * @syscap SystemCapability.ArkUI.ArkUI.Full 1139 * @crossplatform 1140 * @atomicservice 1141 * @since 12 1142 */ 1143declare enum DistributionType { 1144 /** 1145 * Uniform distribution. 1146 * 1147 * @syscap SystemCapability.ArkUI.ArkUI.Full 1148 * @crossplatform 1149 * @atomicservice 1150 * @since 12 1151 */ 1152 UNIFORM = 0, 1153 1154 /** 1155 * Gaussian distribution. 1156 * 1157 * @syscap SystemCapability.ArkUI.ArkUI.Full 1158 * @crossplatform 1159 * @atomicservice 1160 * @since 12 1161 */ 1162 GAUSSIAN = 1, 1163} 1164 1165/** 1166 * Enumerates the updater types of a particle. 1167 * @enum { string } 1168 * @syscap SystemCapability.ArkUI.ArkUI.Full 1169 * @crossplatform 1170 * @since 10 1171 */ 1172/** 1173 * Enumerates the updater types of a particle. 1174 * @enum { string } 1175 * @syscap SystemCapability.ArkUI.ArkUI.Full 1176 * @crossplatform 1177 * @atomicservice 1178 * @since 11 1179 */ 1180declare enum ParticleUpdater { 1181 /** 1182 * No updater is used. 1183 * @syscap SystemCapability.ArkUI.ArkUI.Full 1184 * @crossplatform 1185 * @since 10 1186 */ 1187 /** 1188 * No updater is used. 1189 * @syscap SystemCapability.ArkUI.ArkUI.Full 1190 * @crossplatform 1191 * @atomicservice 1192 * @since 11 1193 */ 1194 NONE = 'none', 1195 1196 /** 1197 * Random updater. 1198 * @syscap SystemCapability.ArkUI.ArkUI.Full 1199 * @crossplatform 1200 * @since 10 1201 */ 1202 /** 1203 * Random updater. 1204 * @syscap SystemCapability.ArkUI.ArkUI.Full 1205 * @crossplatform 1206 * @atomicservice 1207 * @since 11 1208 */ 1209 RANDOM = 'random', 1210 1211 /** 1212 * Curve updater. 1213 * @syscap SystemCapability.ArkUI.ArkUI.Full 1214 * @crossplatform 1215 * @since 10 1216 */ 1217 /** 1218 * Curve updater. 1219 * @syscap SystemCapability.ArkUI.ArkUI.Full 1220 * @crossplatform 1221 * @atomicservice 1222 * @since 11 1223 */ 1224 CURVE = 'curve', 1225} 1226 1227/** 1228 * Defines the SizeT type. 1229 * 1230 * @typedef { import('../api/arkui/Graphics').SizeT<T> } 1231 * @syscap SystemCapability.ArkUI.ArkUI.Full 1232 * @crossplatform 1233 * @atomicservice 1234 * @since 12 1235 */ 1236declare type SizeT<T> = import('../api/arkui/Graphics').SizeT<T>; 1237 1238 /** 1239 * Defines the PositionT type. 1240 * 1241 * @typedef { import('../api/arkui/Graphics').PositionT<T> } 1242 * @syscap SystemCapability.ArkUI.ArkUI.Full 1243 * @crossplatform 1244 * @atomicservice 1245 * @since 12 1246 */ 1247declare type PositionT<T> = import('../api/arkui/Graphics').PositionT<T>; 1248 1249/** 1250 * Defines the Particle component attribute functions. 1251 * @extends CommonMethod<ParticleAttribute> 1252 * @syscap SystemCapability.ArkUI.ArkUI.Full 1253 * @crossplatform 1254 * @since 10 1255 */ 1256/** 1257 * Defines the Particle component attribute functions. 1258 * @extends CommonMethod<ParticleAttribute> 1259 * @syscap SystemCapability.ArkUI.ArkUI.Full 1260 * @crossplatform 1261 * @atomicservice 1262 * @since 11 1263 */ 1264declare class ParticleAttribute extends CommonMethod<ParticleAttribute> { 1265 /** 1266 * Particle disturbance Field. 1267 * 1268 * @param { Array<DisturbanceFieldOptions> } fields - particle disturbance Field params. 1269 * @returns { ParticleAttribute } Returns the particle attribute. 1270 * @syscap SystemCapability.ArkUI.ArkUI.Full 1271 * @crossplatform 1272 * @atomicservice 1273 * @since 12 1274 */ 1275 disturbanceFields(fields: Array<DisturbanceFieldOptions>): ParticleAttribute; 1276 1277 /** 1278 * Add particle animation component properties. 1279 * 1280 * @param { Array<EmitterProperty> } value - The emitter property. 1281 * @returns { ParticleAttribute } Returns the particle attribute. 1282 * @syscap SystemCapability.ArkUI.ArkUI.Full 1283 * @crossplatform 1284 * @atomicservice 1285 * @since 12 1286 */ 1287 emitter(value : Array<EmitterProperty>) : ParticleAttribute; 1288} 1289 1290/** 1291 * Defines Particle Component. 1292 * @syscap SystemCapability.ArkUI.ArkUI.Full 1293 * @crossplatform 1294 * @since 10 1295 */ 1296/** 1297 * Defines Particle Component. 1298 * @syscap SystemCapability.ArkUI.ArkUI.Full 1299 * @crossplatform 1300 * @atomicservice 1301 * @since 11 1302 */ 1303declare const Particle: ParticleInterface; 1304 1305/** 1306 * Defines particle disturbance Field params. 1307 * @interface DisturbanceFieldOptions 1308 * @syscap SystemCapability.ArkUI.ArkUI.Full 1309 * @crossplatform 1310 * @atomicservice 1311 * @since 12 1312 */ 1313declare interface DisturbanceFieldOptions { 1314 1315 /** 1316 * Strength of the repulsive force from the center outward, 1317 * with positive numbers indicating outward repulsion and negative numbers indicating 1318 * inward attraction. 1319 * 1320 * @type { ?number } 1321 * @default 0 1322 * @syscap SystemCapability.ArkUI.ArkUI.Full 1323 * @crossplatform 1324 * @atomicservice 1325 * @since 12 1326 */ 1327 strength?: number; 1328 1329 /** 1330 * Disturbance filed shape. 1331 * 1332 * @type { ?DisturbanceFieldShape } 1333 * @default DisturbanceFieldShape.RECT 1334 * @syscap SystemCapability.ArkUI.ArkUI.Full 1335 * @crossplatform 1336 * @atomicservice 1337 * @since 12 1338 */ 1339 shape?: DisturbanceFieldShape; 1340 1341 /** 1342 * Disturbance filed size width value width, height. 1343 * 1344 * @type { ?SizeT<number> } 1345 * @default {width:0,height:0} 1346 * @syscap SystemCapability.ArkUI.ArkUI.Full 1347 * @crossplatform 1348 * @atomicservice 1349 * @since 12 1350 */ 1351 size?: SizeT<number>; 1352 1353 /** 1354 * Disturbance filed position width value x, y. 1355 * 1356 * @type { ?PositionT<number> } 1357 * @default {x:0,y:0} 1358 * @syscap SystemCapability.ArkUI.ArkUI.Full 1359 * @crossplatform 1360 * @atomicservice 1361 * @since 12 1362 */ 1363 position?: PositionT<number>; 1364 1365 /** 1366 * Attenuation degree of the field from the center point to the field boundary. 1367 * ranging from 0 to 100 integers. If 0, it indicates that the field is a rigid body, 1368 * and all particles within the range will be excluded. 1369 * a larger feather value indicates a greater degree of relaxation in the field, 1370 * and more particles near the center point will appear in the field strength range. The default value is 0. 1371 * 1372 * @type { ?number } 1373 * @default 0 1374 * @syscap SystemCapability.ArkUI.ArkUI.Full 1375 * @crossplatform 1376 * @atomicservice 1377 * @since 12 1378 */ 1379 feather?: number; 1380 1381 /** 1382 * Scaling parameter is used to control the overall size of noise, with a value greater or equal 0. 1383 * 1384 * @type { ?number } 1385 * @default 1 1386 * @syscap SystemCapability.ArkUI.ArkUI.Full 1387 * @crossplatform 1388 * @atomicservice 1389 * @since 12 1390 */ 1391 noiseScale?: number; 1392 1393 /** 1394 * Noise frequency with a value greater or equal 0. 1395 * 1396 * @type { ?number } 1397 * @default 1 1398 * @syscap SystemCapability.ArkUI.ArkUI.Full 1399 * @crossplatform 1400 * @atomicservice 1401 * @since 12 1402 */ 1403 noiseFrequency?: number; 1404 1405 /** 1406 * NoiseAmplitude fluctuation range of noise, value, 1407 * 1408 * @type { ?number } 1409 * @default 1 1410 * @syscap SystemCapability.ArkUI.ArkUI.Full 1411 * @crossplatform 1412 * @atomicservice 1413 * @since 12 1414 */ 1415 noiseAmplitude?: number; 1416} 1417 1418/** 1419 * Defines particle disturbance shape. 1420 * 1421 * @enum { number } 1422 * @syscap SystemCapability.ArkUI.ArkUI.Full 1423 * @crossplatform 1424 * @atomicservice 1425 * @since 12 1426 */ 1427declare enum DisturbanceFieldShape { 1428 1429 /** 1430 * Shape rect. 1431 * 1432 * @syscap SystemCapability.ArkUI.ArkUI.Full 1433 * @crossplatform 1434 * @atomicservice 1435 * @since 12 1436 */ 1437 RECT, 1438 1439 /** 1440 * Shape circle. 1441 * 1442 * @syscap SystemCapability.ArkUI.ArkUI.Full 1443 * @crossplatform 1444 * @atomicservice 1445 * @since 12 1446 */ 1447 CIRCLE, 1448 1449 /** 1450 * Shape eclipse. 1451 * 1452 * @syscap SystemCapability.ArkUI.ArkUI.Full 1453 * @crossplatform 1454 * @atomicservice 1455 * @since 12 1456 */ 1457 ELLIPSE 1458 1459}