1 /* 2 * Copyright (c) 2024 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 * @addtogroup ArkUI_NativeModule 18 * @{ 19 * 20 * @brief Provides animation callbacks of ArkUI on the native side. 21 * 22 * @since 12 23 */ 24 25 /** 26 * @file native_animate.h 27 * 28 * @brief Defines a set of animation APIs of ArkUI on the native side. 29 * 30 * @library libace_ndk.z.so 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @kit ArkUI 33 * @since 12 34 */ 35 36 #ifndef ARKUI_NATIVE_ANIMATE_H 37 #define ARKUI_NATIVE_ANIMATE_H 38 39 #include <cstdint> 40 41 #include "native_type.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Defines the expected frame rate range of the animation. 49 * 50 * @since 12 51 */ 52 typedef struct { 53 /** Expected minimum frame rate. */ 54 uint32_t min; 55 /** Expected maximum frame rate. */ 56 uint32_t max; 57 /** Expected optimal frame rate. */ 58 uint32_t expected; 59 } ArkUI_ExpectedFrameRateRange; 60 61 /** 62 * @brief Defines the callback type for when the animation playback is complete. 63 * 64 * @since 12 65 */ 66 typedef struct { 67 /** Type of the <b>onFinish</b> callback. */ 68 ArkUI_FinishCallbackType type; 69 /** Callback invoked when the animation playback is complete. */ 70 void (*callback)(void* userData); 71 /** Custom type. */ 72 void* userData; 73 } ArkUI_AnimateCompleteCallback; 74 75 /** 76 * @brief Defines the animation configuration. 77 * 78 * @since 12 79 */ 80 typedef struct ArkUI_AnimateOption ArkUI_AnimateOption; 81 82 /** 83 * @brief Defines an interpolation curve. 84 * 85 * @since 12 86 */ 87 typedef struct ArkUI_Curve ArkUI_Curve; 88 89 /** 90 * @brief Defines the pointer to an interpolation curve. 91 * 92 * @since 12 93 */ 94 typedef struct ArkUI_Curve* ArkUI_CurveHandle; 95 96 /** 97 * @brief Defines the keyframe animation parameter object. 98 * 99 * @since 12 100 */ 101 typedef struct ArkUI_KeyframeAnimateOption ArkUI_KeyframeAnimateOption; 102 103 /** 104 * @brief Defines the animator parameter object. 105 * 106 * @since 12 107 */ 108 typedef struct ArkUI_AnimatorOption ArkUI_AnimatorOption; 109 110 /** 111 * @brief Defines the pointer to an animator object. 112 * 113 * @since 12 114 */ 115 typedef struct ArkUI_Animator* ArkUI_AnimatorHandle; 116 117 /** 118 * @brief Defines the animator callback event object. 119 * 120 * @since 12 121 */ 122 typedef struct ArkUI_AnimatorEvent ArkUI_AnimatorEvent; 123 124 /** 125 * @brief Defines the callback object when the animator receives a frame. 126 * 127 * @since 12 128 */ 129 typedef struct ArkUI_AnimatorOnFrameEvent ArkUI_AnimatorOnFrameEvent; 130 131 /** 132 * @brief Defines the transition effect. 133 * 134 * @since 12 135 */ 136 typedef struct ArkUI_TransitionEffect ArkUI_TransitionEffect; 137 138 /** 139 * @brief Implements the native animation APIs provided by ArkUI. 140 * 141 * @version 1 142 * @since 12 143 */ 144 typedef struct { 145 /** 146 * @brief Defines an explicit animation. 147 * 148 * @note Make sure the component attributes to be set in the event closure have been set before. 149 * 150 * @param context Indicates a <b>UIContext</b> instance. 151 * @param option Indicates the pointer to an animation configuration. 152 * @param update Indicates the animation closure. The system automatically inserts a transition animation for the 153 * state change caused by the closure. 154 * @param complete Indicates the callback to be invoked when the animation playback is complete. 155 * @return Returns the error code. 156 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 157 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 158 */ 159 int32_t (*animateTo)(ArkUI_ContextHandle context, ArkUI_AnimateOption* option, ArkUI_ContextCallback* update, 160 ArkUI_AnimateCompleteCallback* complete); 161 162 /** 163 * @brief Sets the keyframe animation. 164 * 165 * 166 * @param context Indicates a <b>UIContext</b> instance. 167 * @param option Indicates the keyframe animation parameters. 168 * @return Returns the error code. 169 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 170 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 171 */ 172 int32_t (*keyframeAnimateTo)(ArkUI_ContextHandle context, ArkUI_KeyframeAnimateOption* option); 173 174 /** 175 * @brief Creates an animator object. 176 * 177 * @param context Indicates a <b>UIContext</b> instance. 178 * @param option Indicates the animator parameters. 179 * @return Returns the pointer to the animator object; returns <b>NULL</b> if a function parameter error occurs. 180 */ 181 ArkUI_AnimatorHandle (*createAnimator)(ArkUI_ContextHandle context, ArkUI_AnimatorOption* option); 182 183 /** 184 * @brief Disposes of an animator object. 185 * 186 * @param animator Indicates the target animator object. 187 */ 188 void (*disposeAnimator)(ArkUI_AnimatorHandle animatorHandle); 189 } ArkUI_NativeAnimateAPI_1; 190 191 /** 192 * @brief Creates an animation configuration. 193 * 194 * @return Returns the pointer to the created animation configuration. 195 * @since 12 196 */ 197 ArkUI_AnimateOption* OH_ArkUI_AnimateOption_Create(); 198 199 /** 200 * @brief Disposes of an animation configuration. 201 * 202 * @since 12 203 */ 204 void OH_ArkUI_AnimateOption_Dispose(ArkUI_AnimateOption* option); 205 206 /** 207 * @brief Obtains the animation duration, in milliseconds. 208 * 209 * @param option Indicates the pointer to an animation configuration. 210 * @return Returns the duration. 211 * @since 12 212 */ 213 uint32_t OH_ArkUI_AnimateOption_GetDuration(ArkUI_AnimateOption* option); 214 215 /** 216 * @brief Obtains the animation playback speed. 217 * 218 * @param option Indicates the pointer to an animation configuration. 219 * @return Returns the animation playback speed. 220 * @since 12 221 */ 222 float OH_ArkUI_AnimateOption_GetTempo(ArkUI_AnimateOption* option); 223 224 /** 225 * @brief Obtains the animation curve. 226 * 227 * @param option Indicates the pointer to an animation configuration. 228 * @return Returns the animated curve.If Null is returned, it means option is an invalid value. 229 * @since 12 230 */ 231 ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option); 232 233 /** 234 * @brief Obtains the animation delay, in milliseconds. 235 * 236 * @param option Indicates the pointer to an animation configuration. 237 * @return Returns the animation delay. 238 * @since 12 239 */ 240 int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option); 241 242 /** 243 * @brief Obtains the number of times that an animation is played. 244 * 245 * @param option Indicates the pointer to an animation configuration. 246 * @return Returns the number of times that the animation is played. 247 * @since 12 248 */ 249 int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option); 250 251 /** 252 * @brief Obtains the animation playback mode. 253 * 254 * @param option Indicates the pointer to an animation configuration. 255 * @return Returns the animation playback mode. 256 * @since 12 257 */ 258 ArkUI_AnimationPlayMode OH_ArkUI_AnimateOption_GetPlayMode(ArkUI_AnimateOption* option); 259 260 /** 261 * @brief Obtains the expected frame rate range of an animation. 262 * 263 * @param option Indicates the pointer to an animation configuration. 264 * @return Returns the expected frame rate range. 265 * @since 12 266 */ 267 ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(ArkUI_AnimateOption* option); 268 269 /** 270 * @brief Sets the animation duration. 271 * 272 * @param option Indicates the pointer to an animation configuration. 273 * @param value Indicates the duration, in milliseconds. 274 * @since 12 275 */ 276 void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value); 277 278 /** 279 * @brief Sets the animation playback speed. 280 * 281 * @param option Indicates the pointer to an animation configuration. 282 * @param value Indicates the animation playback speed. 283 * @since 12 284 */ 285 void OH_ArkUI_AnimateOption_SetTempo(ArkUI_AnimateOption* option, float value); 286 287 /** 288 * @brief Sets the animation curve. 289 * 290 * @param option Indicates the pointer to an animation configuration. 291 * @param value Indicates the animated curve. Default value:ARKUI_CURVE_LINEAR. 292 * @since 12 293 */ 294 void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_AnimationCurve value); 295 296 /** 297 * @brief Sets the animation delay. 298 * 299 * @param option Indicates the pointer to an animation configuration. 300 * @param value Indicates the animation delay. 301 * @since 12 302 */ 303 void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value); 304 305 /** 306 * @brief Sets the number of times that an animation is played. 307 * 308 * @param option Indicates the pointer to an animation configuration. 309 * @param value Indicates the number of times that the animation is played. 310 * @since 12 311 */ 312 void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value); 313 314 /** 315 * @brief Sets the animation playback mode. 316 * 317 * @param option Indicates the pointer to an animation configuration. 318 * @param value Indicates the animation playback mode. 319 * @since 12 320 */ 321 void OH_ArkUI_AnimateOption_SetPlayMode(ArkUI_AnimateOption* option, ArkUI_AnimationPlayMode value); 322 323 /** 324 * @brief Sets the expected frame rate range of an animation. 325 * 326 * @param option Indicates the pointer to an animation configuration. 327 * @param value Indicates the expected frame rate range. 328 * @since 12 329 */ 330 void OH_ArkUI_AnimateOption_SetExpectedFrameRateRange(ArkUI_AnimateOption* option, ArkUI_ExpectedFrameRateRange* value); 331 332 /** 333 * @brief Sets the animation curve for the animation of an animator. 334 * 335 * @note This method is better than the value set by OH_ArkUI_AnimateOption_SetCurve. 336 * @param option Indicates the animator parameters. 337 * @param value Indicates the animation curve settings. 338 * @since 12 339 */ 340 void OH_ArkUI_AnimateOption_SetICurve(ArkUI_AnimateOption* option, ArkUI_CurveHandle value); 341 342 /** 343 * @brief Obtains the animation curve of the animation of an animator. 344 * 345 * @param option Indicates the animator parameters. 346 * @return Returns the animation curve of the specified animation. 347 * If Null is returned, it means option is an invalid value. 348 * @since 12 349 */ 350 ArkUI_CurveHandle OH_ArkUI_AnimateOption_GetICurve(ArkUI_AnimateOption* option); 351 352 /** 353 * @brief Obtains the keyframe animation parameters. 354 * 355 * @param size Indicates the number of keyframe animation states. 356 * @return Returns the keyframe animation parameter object; returns <b>NULL</b> if the value of <b>size</b> is less than 357 * 0. 358 * @since 12 359 */ 360 ArkUI_KeyframeAnimateOption* OH_ArkUI_KeyframeAnimateOption_Create(int32_t size); 361 362 /** 363 * @brief Disposes of the keyframe animation parameter object. 364 * 365 * @param option Indicates the keyframe animation parameter object. 366 * @since 12 367 */ 368 void OH_ArkUI_KeyframeAnimateOption_Dispose(ArkUI_KeyframeAnimateOption* option); 369 370 /** 371 * @brief Sets the overall delay of a keyframe animation, in milliseconds. By default, the keyframe animation is played 372 * without delay. 373 * 374 * @param option Indicates the keyframe animation parameters. 375 * @param value Indicates the delay, in milliseconds. 376 * @return Returns the error code. 377 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 378 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 379 * @since 12 380 */ 381 int32_t OH_ArkUI_KeyframeAnimateOption_SetDelay(ArkUI_KeyframeAnimateOption* option, int32_t value); 382 383 /** 384 * @brief Sets the number of times that the keyframe animation is played. By default, the animation is played once. 385 * The value <b>-1</b> indicates that the animation is played for an unlimited number of times. The value <b>0</b> 386 * indicates that there is no animation. 387 * 388 * @param option Indicates the keyframe animation parameters. 389 * @param value Indicates the number of times that the animation is played. 390 * @return Returns the error code. 391 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 392 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 393 * @since 12 394 */ 395 int32_t OH_ArkUI_KeyframeAnimateOption_SetIterations(ArkUI_KeyframeAnimateOption* option, int32_t value); 396 397 /** 398 * @brief Sets the callback invoked when the keyframe animation playback is complete. This API is called after the 399 * keyframe animation has played for the specified number of times. 400 * 401 * @param option Indicates the keyframe animation parameters. 402 * @param userData Indicates the pointer to a custom object. 403 * @param onFinish Indicates the callback. 404 * @return Returns the error code. 405 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 406 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 407 * @since 12 408 */ 409 int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnFinishCallback( 410 ArkUI_KeyframeAnimateOption* option, void* userData, void (*onFinish)(void* userData)); 411 412 /** 413 * @brief Sets the duration of a keyframe animation, in milliseconds. 414 * 415 * @param option Indicates the keyframe animation parameters. 416 * @param value Indicates the duration to set, in milliseconds. 417 * @param index Indicates a state index. 418 * @return Returns the error code. 419 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 420 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 421 * @since 12 422 */ 423 int32_t OH_ArkUI_KeyframeAnimateOption_SetDuration(ArkUI_KeyframeAnimateOption* option, int32_t value, int32_t index); 424 425 /** 426 * @brief Sets the animation curve for a specific keyframe in a keyframe animation. 427 * 428 * @note Because the <b>springMotion</b>, <b>responsiveSpringMotion</b>, and <b>interpolatingSpring</b> curves do not 429 * have effective duration settings, they are not supported. 430 * @param option Indicates the keyframe animation parameters. 431 * @param value Indicates the animation curve to set. Default value:EASE_IN_OUT. 432 * @param index Indicates a state index. 433 * @return Returns the error code. 434 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 435 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 436 * @since 12 437 */ 438 int32_t OH_ArkUI_KeyframeAnimateOption_SetCurve( 439 ArkUI_KeyframeAnimateOption* option, ArkUI_CurveHandle value, int32_t index); 440 441 /** 442 * @brief Sets the closure function of the state at the time of the keyframe, that is, the state to be reached at the 443 * time of the keyframe. 444 * 445 * @param option Indicates the keyframe animation parameters. 446 * @param event Indicates a closure function. 447 * @param userData Indicates the pointer to a custom object. 448 * @param index Indicates a state index. 449 * @return Returns the error code. 450 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 451 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 452 * @since 12 453 */ 454 int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnEventCallback( 455 ArkUI_KeyframeAnimateOption* option, void* userData, void (*event)(void* userData), int32_t index); 456 457 /** 458 * @brief Obtains the overall delay of a keyframe animation 459 * 460 * @param option Indicates the keyframe animation parameters. 461 * @return Returns the overall delay. 462 * @since 12 463 */ 464 int32_t OH_ArkUI_KeyframeAnimateOption_GetDelay(ArkUI_KeyframeAnimateOption* option); 465 466 /** 467 * @brief Obtains the number of times that a keyframe animation is played. 468 * 469 * @param option Indicates the keyframe animation parameters. 470 * @return Returns the number of times that the animation is played. 471 * @since 12 472 */ 473 int32_t OH_ArkUI_KeyframeAnimateOption_GetIterations(ArkUI_KeyframeAnimateOption* option); 474 475 /** 476 * @brief Obtains the duration of a specific state in a keyframe animation. 477 * 478 * @param option Indicates the keyframe animation parameters. 479 * @param index Indicates a state index. 480 * @return Returns the duration. The unit is millisecond. 481 * @since 12 482 */ 483 int32_t OH_ArkUI_KeyframeAnimateOption_GetDuration(ArkUI_KeyframeAnimateOption* option, int32_t index); 484 485 /** 486 * @brief Obtains the animation curve of a specific state in a keyframe animation. 487 * 488 * @param option Indicates the keyframe animation parameters. 489 * @param index Indicates a state index. 490 * @return Returns the animated curve. 491 * Returns <b>NULL</b> if a parameter error occurs. 492 * @since 12 493 */ 494 ArkUI_CurveHandle OH_ArkUI_KeyframeAnimateOption_GetCurve(ArkUI_KeyframeAnimateOption* option, int32_t index); 495 496 /** 497 * @brief Creates an animator parameter object. 498 * 499 * @note When <b>keyframeSize</b> is greater than 0, the animation interpolation start point is 0, and the animation 500 * interpolation end point is 1; no setting is allowed. 501 * @param keyframeSize Indicates the number of keyframes. 502 * @return Returns the pointer to the animator parameter object. 503 * returns <b>NULL</b> if the value of <b>size</b> is less than 0. 504 * @since 12 505 */ 506 ArkUI_AnimatorOption* OH_ArkUI_AnimatorOption_Create(int32_t keyframeSize); 507 508 /** 509 * @brief Disposes of an animator parameter object. 510 * 511 * @since 12 512 */ 513 void OH_ArkUI_AnimatorOption_Dispose(ArkUI_AnimatorOption* option); 514 515 /** 516 * @brief Sets the duration for thea nimation of an animator, in milliseconds. 517 * 518 * @param option Indicates the target animator parameter object. 519 * @param value Indicates the playback duration, in milliseconds. 520 * @return Returns the error code. 521 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 522 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 523 * @since 12 524 */ 525 int32_t OH_ArkUI_AnimatorOption_SetDuration(ArkUI_AnimatorOption* option, int32_t value); 526 527 /** 528 * @brief Sets the delay for playing the animation of an animator, in milliseconds. 529 * 530 * @param option Indicates an animator parameter object. 531 * @param value Indicates the delay to set, in milliseconds. 532 * @return Returns the error code. 533 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 534 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 535 * @since 12 536 */ 537 int32_t OH_ArkUI_AnimatorOption_SetDelay(ArkUI_AnimatorOption* option, int32_t value); 538 539 /** 540 * @brief Sets the number of times that the animation of an animator is played. The value <b>0</b> means not to play the 541 * animation, and <b>-1</b> means to play the animation for an unlimited number of times. 542 * 543 * @note If this parameter is set to a negative value other than <b>-1</b>, the value is invalid. In this case, the 544 * animation is played once. 545 * @param option Indicates an animator parameter object. 546 * @param value Indicates the number of times that the animation is played. 547 * @return Returns the error code. 548 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 549 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 550 * @since 12 551 */ 552 int32_t OH_ArkUI_AnimatorOption_SetIterations(ArkUI_AnimatorOption* option, int32_t value); 553 554 /** 555 * @brief Sets whether the animation of an animator is restored to the initial state after being executed. 556 * 557 * @param option Indicates an animator parameter object. 558 * @param value Indicates whether to restore the animation to the initial state after the animation is executed. 559 * @return Returns the error code. 560 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 561 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 562 * @since 12 563 */ 564 int32_t OH_ArkUI_AnimatorOption_SetFill(ArkUI_AnimatorOption* option, ArkUI_AnimationFillMode value); 565 566 /** 567 * @brief Sets the playback direction for the animation of an animator. 568 * 569 * @param option Indicates an animator parameter object. 570 * @param value Indicates the animation playback direction. 571 * @return Returns the error code. 572 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 573 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 574 * @since 12 575 */ 576 int32_t OH_ArkUI_AnimatorOption_SetDirection(ArkUI_AnimatorOption* option, ArkUI_AnimationDirection value); 577 578 /** 579 * @brief Sets the interpolation curve for the animation of an animator. 580 * 581 * @note <b>springCurve</b>, <b>springMotion</b>, <b>responsiveSpringMotion</b>, <b>interpolatingSpring</b>, 582 * and <b>customCurve</b> curves are not supported. 583 * 584 * @param option Indicates an animator parameter object. 585 * @param value Indicates the target interpolation curve. Default value:ARKUI_CURVE_LINEAR. 586 * @return Returns the error code. 587 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 588 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 589 * @since 12 590 */ 591 int32_t OH_ArkUI_AnimatorOption_SetCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value); 592 593 /** 594 * @brief Sets the interpolation start point for the animation of an animator. 595 * @note This API does not take effect when the animation is a keyframe animation. 596 * 597 * @param option Indicates an animator parameter object. 598 * @param value Indicates the interpolation start point to set. 599 * @return Returns the error code. 600 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 601 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 602 * @since 12 603 */ 604 int32_t OH_ArkUI_AnimatorOption_SetBegin(ArkUI_AnimatorOption* option, float value); 605 606 /** 607 * @brief Sets the interpolation end point for the animation of an animator. 608 * @note This API does not take effect when the animation is a keyframe animation. 609 * 610 * @param option Indicates an animator parameter object. 611 * @param value Indicates the interpolation end point to set. 612 * @return Returns the error code. 613 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 614 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 615 * @since 12 616 */ 617 int32_t OH_ArkUI_AnimatorOption_SetEnd(ArkUI_AnimatorOption* option, float value); 618 619 /** 620 * @brief Sets the expected frame rate range for the animation of an animator. 621 * 622 * @param option Indicates an animator parameter object. 623 * @param value Indicates the expected frame rate range to set. 624 * @return Returns the error code. 625 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 626 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 627 * @since 12 628 */ 629 int32_t OH_ArkUI_AnimatorOption_SetExpectedFrameRateRange( 630 ArkUI_AnimatorOption* option, ArkUI_ExpectedFrameRateRange* value); 631 632 /** 633 * @brief Sets the keyframe parameters for the animation of an animator. 634 * 635 * @param option Indicates an animator parameter object. 636 * @param time Indicates the keyframe time. Value range: [0,1]. 637 * @param value Indicates the keyframe value. 638 * @param index Indicates the keyframe index. 639 * @return Returns the error code. 640 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 641 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 642 * @since 12 643 */ 644 int32_t OH_ArkUI_AnimatorOption_SetKeyframe( 645 ArkUI_AnimatorOption* option, float time, float value, int32_t index); 646 647 /** 648 * @brief Sets the keyframe curve type for the animation of an animator. 649 * 650 * @note <b>springCurve</b>, <b>springMotion</b>, <b>responsiveSpringMotion</b>, <b>interpolatingSpring</b>, 651 * and <b>customCurve</b> curves are not supported. 652 * 653 * @param option Indicates an animator parameter object. 654 * @param value Indicates the target interpolation curve. 655 * @param index Indicates the keyframe index. 656 * @return Returns the error code. 657 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 658 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 659 * @since 12 660 */ 661 int32_t OH_ArkUI_AnimatorOption_SetKeyframeCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value, int32_t index); 662 /** 663 * @brief Obtains the duration for playing an animation. 664 * 665 * @param option Indicates the animator parameters. 666 * @return Returns the duration for playing the animation, in milliseconds. 667 * @since 12 668 */ 669 int32_t OH_ArkUI_AnimatorOption_GetDuration(ArkUI_AnimatorOption* option); 670 671 /** 672 * @brief Obtains the delay for playing the animation of an animator. 673 * 674 * @param option Indicates the animator parameters. 675 * @return Returns the delay for playing the animation, in milliseconds. 676 * @since 12 677 */ 678 int32_t OH_ArkUI_AnimatorOption_GetDelay(ArkUI_AnimatorOption* option); 679 680 /** 681 * @brief Obtains the number of times that an animation is played. 682 * 683 * @param option Animator animation parameter. 684 * @return Returns the number of times that the animation is played. 685 * @since 12 686 */ 687 int32_t OH_ArkUI_AnimatorOption_GetIterations(ArkUI_AnimatorOption* option); 688 689 /** 690 * @brief Obtains whether the animator animation is restored to the initial state after being executed. 691 * 692 * @param option Indicates the animator parameters. 693 * @return Returns whether the animator animation is restored to the initial state after being executed. 694 * @since 12 695 */ 696 ArkUI_AnimationFillMode OH_ArkUI_AnimatorOption_GetFill(ArkUI_AnimatorOption* option); 697 698 /** 699 * @brief Obtains the playback direction of an animation. 700 * 701 * @param option Indicates the animator parameters. 702 * @return Returns the animation playback direction. 703 * @since 12 704 */ 705 ArkUI_AnimationDirection OH_ArkUI_AnimatorOption_GetDirection(ArkUI_AnimatorOption* option); 706 707 /** 708 * @brief Obtains the interpolation curve of the animation of an animator. 709 * 710 * @param option Indicates the animator parameters. 711 * @return Returns the interpolation curve of the animation. 712 * Returns <b>NULL</b> if a parameter error occurs. 713 * @since 12 714 */ 715 ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetCurve(ArkUI_AnimatorOption* option); 716 717 /** 718 * @brief Obtains the interpolation start point of an animation. 719 * 720 * @param option Indicates the animator parameters. 721 * @return Returns the interpolation start point of the animation. 722 * @since 12 723 */ 724 float OH_ArkUI_AnimatorOption_GetBegin(ArkUI_AnimatorOption* option); 725 726 /** 727 * @brief Obtains the interpolation end point of an animation. 728 * 729 * @param option Indicates the animator parameters. 730 * @return Returns the interpolation end point of the animation. 731 * @since 12 732 */ 733 float OH_ArkUI_AnimatorOption_GetEnd(ArkUI_AnimatorOption* option); 734 735 /** 736 * @brief Obtains the expected frame rate range of an animation. 737 * 738 * @param option Indicates the animator parameters. 739 * @return Returns the pointer to the expected frame rate range object. 740 * Returns <b>NULL</b> if a parameter error occurs. 741 * @since 12 742 */ 743 ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimatorOption_GetExpectedFrameRateRange(ArkUI_AnimatorOption* option); 744 745 /** 746 * @brief Obtains the keyframe time of an animation. 747 * 748 * @param option Indicates an animator parameter object. 749 * @param index Indicates the keyframe index. 750 * @return Returns the keyframe time. 751 * @since 12 752 */ 753 float OH_ArkUI_AnimatorOption_GetKeyframeTime(ArkUI_AnimatorOption* option, int32_t index); 754 755 /** 756 * @brief Obtains the keyframe value of an animation. 757 * 758 * @param option Indicates an animator parameter object. 759 * @param index Indicates the keyframe index. 760 * @return Returns the keyframe value. 761 * @since 12 762 */ 763 float OH_ArkUI_AnimatorOption_GetKeyframeValue(ArkUI_AnimatorOption* option, int32_t index); 764 765 /** 766 * @brief Obtains the interpolation curve for a keyframe in the animation of an animator. 767 * 768 * @param option Indicates an animator parameter object. 769 * @param index Indicates the keyframe index. 770 * @return Returns the interpolation curve. 771 * Returns <b>NULL</b> if a parameter error occurs. 772 * @since 12 773 */ 774 ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetKeyframeCurve(ArkUI_AnimatorOption* option, int32_t index); 775 776 /** 777 * @brief Obtains the custom object in an animation event object. 778 * 779 * @param event Indicates an animation event object. 780 * @return Returns the custom object. 781 * Returns <b>NULL</b> if a parameter error occurs. 782 * @since 12 783 */ 784 void* OH_ArkUI_AnimatorEvent_GetUserData(ArkUI_AnimatorEvent* event); 785 786 /** 787 * @brief Obtains the custom object in an animation event object. 788 * 789 * @param event Indicates an animation event object. 790 * @return Returns the custom object. 791 * @since 12 792 */ 793 void* OH_ArkUI_AnimatorOnFrameEvent_GetUserData(ArkUI_AnimatorOnFrameEvent* event); 794 795 /** 796 * @brief Obtains the current progress in an animation event object. 797 * 798 * @param event Indicates an animation event object. 799 * @return Returns the animation progress. 800 * @since 12 801 */ 802 float OH_ArkUI_AnimatorOnFrameEvent_GetValue(ArkUI_AnimatorOnFrameEvent* event); 803 804 /** 805 * @brief Sets the callback invoked when the animator receives a frame. 806 * 807 * @param option Indicates an animator parameter object. 808 * @param userData Indicates the custom parameter. 809 * @param callback Indicates the callback to set. 810 * @return Returns the error code. 811 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 812 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 813 * @since 12 814 */ 815 int32_t OH_ArkUI_AnimatorOption_RegisterOnFrameCallback( 816 ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorOnFrameEvent* event)); 817 818 /** 819 * @brief Sets the callback invoked when the animation playback is complete. 820 * 821 * @param option Indicates an animator parameter object. 822 * @param userData Indicates the custom parameter. 823 * @param callback Indicates the callback to set. 824 * @return Returns the error code. 825 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 826 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 827 * @since 12 828 */ 829 int32_t OH_ArkUI_AnimatorOption_RegisterOnFinishCallback( 830 ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)); 831 832 /** 833 * @brief Sets the callback invoked when the animation playback is canceled. 834 * 835 * @param option Indicates an animator parameter object. 836 * @param userData Indicates the custom parameter. 837 * @param callback Indicates the callback to set. 838 * @return Returns the error code. 839 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 840 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 841 * @since 12 842 */ 843 int32_t OH_ArkUI_AnimatorOption_RegisterOnCancelCallback( 844 ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)); 845 846 /** 847 * @brief Sets the callback invoked when the animation playback is repeated. 848 * 849 * @param option Indicates an animator parameter object. 850 * @param userData Indicates the custom parameter. 851 * @param callback Indicates the callback to set. 852 * @return Returns the error code. 853 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 854 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 855 * @since 12 856 */ 857 int32_t OH_ArkUI_AnimatorOption_RegisterOnRepeatCallback( 858 ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)); 859 860 /** 861 * @brief Resets the animation of an animator. 862 * 863 * @param animatorHandle Indicates an animator object. 864 * @param option Indicates the animator parameters. 865 * @return Returns the error code. 866 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 867 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 868 * @since 12 869 */ 870 int32_t OH_ArkUI_Animator_ResetAnimatorOption( 871 ArkUI_AnimatorHandle animatorHandle, ArkUI_AnimatorOption* option); 872 873 /** 874 * @brief Starts the animation of an animator. 875 * 876 * @param animatorHandle Indicates an animator object. 877 * @return Returns the error code. 878 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 879 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 880 * @since 12 881 */ 882 int32_t OH_ArkUI_Animator_Play(ArkUI_AnimatorHandle animatorHandle); 883 884 /** 885 * @brief Ends the animation of an animator. 886 * 887 * @param animatorHandle Indicates an animator object. 888 * @return Returns the error code. 889 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 890 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 891 * @since 12 892 */ 893 int32_t OH_ArkUI_Animator_Finish(ArkUI_AnimatorHandle animatorHandle); 894 895 /** 896 * @brief Pauses the animation of an animator. 897 * 898 * @param animatorHandle Indicates an animator object. 899 * @return Returns the error code. 900 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 901 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 902 * @since 12 903 */ 904 int32_t OH_ArkUI_Animator_Pause(ArkUI_AnimatorHandle animatorHandle); 905 906 /** 907 * @brief Cancels the animation of an animator. 908 * 909 * @param animatorHandle Indicates an animator object. 910 * @return Returns the error code. 911 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 912 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 913 * @since 12 914 */ 915 int32_t OH_ArkUI_Animator_Cancel(ArkUI_AnimatorHandle animatorHandle); 916 917 /** 918 * @brief Plays the animation of an animator in reverse order. 919 * 920 * @param animatorHandle Indicates an animator object. 921 * @return Returns the error code. 922 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 923 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 924 * @since 12 925 */ 926 int32_t OH_ArkUI_Animator_Reverse(ArkUI_AnimatorHandle animatorHandle); 927 928 /** 929 * @brief Implements initialization for the interpolation curve, which is used to create an interpolation curve based on 930 * the input parameter. 931 * 932 * @param curve Indicates the curve type. 933 * @return Returns the pointer to the interpolation object of the curve. 934 * Returns <b>NULL</b> if a parameter error occurs. 935 */ 936 ArkUI_CurveHandle OH_ArkUI_Curve_CreateCurveByType(ArkUI_AnimationCurve curve); 937 938 /** 939 * @brief Creates a step curve. 940 * 941 * @param count Indicates the number of steps. The value must be a positive integer. Value range: [1, +∞). 942 * @param end Indicates whether jumping occurs when the interpolation ends. 943 * <b>true</b>: Jumping occurs when the interpolation ends. <b>false</b>: Jumping occurs when the interpolation starts. 944 * @return Returns the pointer to the interpolation object of the curve. 945 * Returns <b>NULL</b> if a parameter error occurs. 946 */ 947 ArkUI_CurveHandle OH_ArkUI_Curve_CreateStepsCurve(int32_t count, bool end); 948 949 /** 950 * @brief Creates a cubic Bezier curve. 951 * 952 * 953 * @param x1 Indicates the X coordinate of the first point on the Bezier curve. Value range: [0, 1]. 954 * A value less than 0 is handed as <b>0</b>. A value greater than 1 is handed as <b>1</b>. 955 * @param y1 Indicates the Y coordinate of the first point on the Bezier curve. 956 * @param x2 Indicates the X coordinate of the second point on the Bezier curve. Value range: [0, 1]. 957 * A value less than 0 is handed as <b>0</b>. A value greater than 1 is handed as <b>1</b>. 958 * @param y2 Indicates the Y coordinate of the second point on the Bezier curve. 959 * @return Returns the pointer to the interpolation object of the curve. 960 * Returns <b>NULL</b> if a parameter error occurs. 961 */ 962 ArkUI_CurveHandle OH_ArkUI_Curve_CreateCubicBezierCurve(float x1, float y1, float x2, float y2); 963 964 /** 965 * @brief Creates a spring curve. The curve shape is subject to the spring parameters, and the animation duration is 966 * subject to the <b>duration</b> parameter in <b>animation</b> and <b>animateTo</b>. 967 * 968 * @param velocity Indicates the initial velocity of the spring. It is applied by external factors to the spring 969 * animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the 970 * normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the 971 * animation attribute change value. 972 * @param mass Indicates the mass, which influences the inertia in the spring system. The greater the mass, the greater 973 * the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position. 974 * @param stiffness Indicates the stiffness. It is the degree to which an object deforms by resisting the force applied. 975 * In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the 976 * speed of restoring to the equilibrium position. 977 * @param damping Indicates the damping. It is used to describe the oscillation and attenuation of the system after 978 * being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller 979 * the oscillation amplitude. 980 * @return Returns the pointer to the interpolation object of the curve. 981 * Returns <b>NULL</b> if a parameter error occurs. 982 */ 983 ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringCurve(float velocity, float mass, float stiffness, float damping); 984 985 /** 986 * @brief Creates a spring animation curve. If multiple spring animations are applied to the same attribute of an 987 * object, each animation replaces their predecessor and inherits the velocity. 988 * @note The animation duration is subject to the curve parameters, rather than the <b>duration</b> parameter in 989 * <b>animation</b> or <b>animateTo</b>. 990 * 991 * @param response Indicates the duration of one complete oscillation. 992 * @param dampingFraction Indicates the damping coefficient. 993 * > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. 994 * <b>1</b>: critically damped. 995 * > 1: overdamped. In this case, the spring approaches equilibrium gradually. 996 * @param overlapDuration Indicates the duration for animations to overlap. When animations overlap, the <b>response</b> 997 * values of these animations will 998 * transit smoothly over this duration if they are different. 999 * @return Returns the pointer to the interpolation object of the curve. 1000 * Returns <b>NULL</b> if a parameter error occurs. 1001 */ 1002 ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringMotion(float response, float dampingFraction, float overlapDuration); 1003 1004 /** 1005 * @brief Creates a responsive spring animation curve. It is a special case of <b>springMotion</b>, with the only 1006 * difference in the default values. It can be used together with <b>springMotion</b>. 1007 * @note The animation duration is subject to the curve parameters, rather than the <b>duration</b> parameter in 1008 * <b>animation</b> or <b>animateTo</b>. 1009 * 1010 * @param response Indicates the duration of one complete oscillation. 1011 * @param dampingFraction Indicates the damping coefficient. 1012 * > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. 1013 * <b>1</b>: critically damped. 1014 * > 1: overdamped. In this case, the spring approaches equilibrium gradually. 1015 * @param overlapDuration Indicates the duration for animations to overlap. When animations overlap, the 1016 * <b>response</b> values of these animations will 1017 * transit smoothly over this duration if they are different. 1018 * @return Returns the pointer to the interpolation object of the curve. 1019 * Returns <b>NULL</b> if a parameter error occurs. 1020 */ 1021 ArkUI_CurveHandle OH_ArkUI_Curve_CreateResponsiveSpringMotion( 1022 float response, float dampingFraction, float overlapDuration); 1023 1024 /** 1025 * @brief Creates an interpolating spring curve animated from 0 to 1. The actual animation value is calculated based on 1026 * the curve. 1027 * @note The animation duration is subject to the curve parameters, rather than the <b>duration</b> parameter in 1028 * <b>animation</b> or <b>animateTo</b>. 1029 * 1030 * 1031 * @param velocity Indicates the initial velocity of the spring. It is applied by external factors to the spring 1032 * animation, esigned to help ensure the smooth transition from the previous motion state. The velocity is the 1033 * normalized velocity, and its value is equal to the actual velocity 1034 * at the beginning of the animation divided by the animation attribute change value. 1035 * @param mass Indicates the mass, which influences the inertia in the spring system. 1036 * The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the 1037 * equilibrium position. 1038 * @param stiffness Indicates the stiffness. It is the degree to which an object deforms by resisting the force applied. 1039 * In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the 1040 * speed of restoring to the equilibrium position. 1041 * @param damping Indicates the damping. It is used to describe the oscillation and attenuation of the system after 1042 * being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller 1043 * the oscillation amplitude. 1044 * @return Returns the pointer to the interpolation object of the curve. 1045 * Returns <b>NULL</b> if a parameter error occurs. 1046 */ 1047 ArkUI_CurveHandle OH_ArkUI_Curve_CreateInterpolatingSpring(float velocity, float mass, float stiffness, float damping); 1048 1049 /** 1050 * @brief Creates a custom curve. 1051 * 1052 * @param userData Indicates the custom data. 1053 * @param interpolate Indicates the custom interpolation callback. <b>fraction</b> indicates the input x value for 1054 * interpolation when the animation starts; value range: [0,1]. 1055 * The return value is the y value of the curve; value range: [0,1]. 1056 * If <b>fraction</b> is <b>0</b>, the return value <b>0</b> corresponds to the animation start point; any other return 1057 * value means that the animation jumps at the start point. 1058 * If <b>fraction</b> is <b>1</b>, the return value <b>1</b> corresponds to the animation end point; any other return 1059 * value means that the end value of the animation is not the value of the state variable, 1060 * which will result in an effect of transition from that end value to the value of the state variable. 1061 * @return Returns the pointer to the interpolation object of the curve. 1062 * Returns <b>NULL</b> if a parameter error occurs. 1063 */ 1064 ArkUI_CurveHandle OH_ArkUI_Curve_CreateCustomCurve( 1065 void* userData, float (*interpolate)(float fraction, void* userdata)); 1066 1067 /** 1068 * @brief Disposes of a custom curve. 1069 * 1070 * @param curve Indicates the pointer to the interpolation object of the curve. 1071 */ 1072 void OH_ArkUI_Curve_DisposeCurve(ArkUI_CurveHandle curveHandle); 1073 1074 /** 1075 * @brief Creates an opacity object for component transition. 1076 * 1077 * @note If the value specified is less than 0, the value <b>0</b> is used. If the value specified is greater than 1, 1078 * the value <b>1</b> is used. 1079 * @param opacity Indicates the opacity. Value range: [0, 1]. 1080 * @return Returns the created opacity object for component transition. 1081 * @since 12 1082 */ 1083 ArkUI_TransitionEffect* OH_ArkUI_CreateOpacityTransitionEffect(float opacity); 1084 1085 /** 1086 * @brief Creates a translation object for component transition. 1087 * 1088 * @param translate Indicates the translation settings for component transition. 1089 * @return Returns the translation object created for component transition. 1090 * Returns <b>NULL</b> if a parameter error occurs. 1091 * @since 12 1092 */ 1093 ArkUI_TransitionEffect* OH_ArkUI_CreateTranslationTransitionEffect(ArkUI_TranslationOptions* translate); 1094 1095 /** 1096 * @brief Creates a scaling object for component transition. 1097 * 1098 * @param scale Indicates the scaling settings for component transition. 1099 * @return Returns the scaling object created for component transition. 1100 * Returns <b>NULL</b> if a parameter error occurs. 1101 * @since 12 1102 */ 1103 ArkUI_TransitionEffect* OH_ArkUI_CreateScaleTransitionEffect(ArkUI_ScaleOptions* scale); 1104 1105 /** 1106 * @brief Creates a rotation object for component transition. 1107 * 1108 * @param rotate Indicates the rotation settings for component transition. 1109 * @return Returns the rotation object created for component transition. 1110 * Returns <b>NULL</b> if a parameter error occurs. 1111 * @since 12 1112 */ 1113 ArkUI_TransitionEffect* OH_ArkUI_CreateRotationTransitionEffect(ArkUI_RotationOptions* rotate); 1114 1115 /** 1116 * @brief Creates a movement object for component transition. 1117 * 1118 * @param edge Indicates the movement type. 1119 * @return Returns the movement object created for component transition. 1120 * Returns <b>NULL</b> if a parameter error occurs. 1121 * @since 12 1122 */ 1123 ArkUI_TransitionEffect* OH_ArkUI_CreateMovementTransitionEffect(ArkUI_TransitionEdge edge); 1124 1125 /** 1126 * @brief Creates an asymmetric transition effect. 1127 * 1128 * @note If the <b>asymmetric</b> function is not used for <b>TransitionEffect</b>, the transition effect takes effect 1129 * for both appearance and disappearance of the component. 1130 * @param appear Indicates the transition effect for appearance. 1131 * @param disappear Indicates the transition effect for disappearance. 1132 * @return Returns the asymmetric transition effect. 1133 * Returns <b>NULL</b> if a parameter error occurs. 1134 * @since 12 1135 */ 1136 ArkUI_TransitionEffect* OH_ArkUI_CreateAsymmetricTransitionEffect( 1137 ArkUI_TransitionEffect* appear, ArkUI_TransitionEffect* disappear); 1138 1139 /** 1140 * @brief Disposes of a transition effect. 1141 * 1142 * @param effect Indicates the transition effect to dispose of. 1143 * @since 12 1144 */ 1145 void OH_ArkUI_TransitionEffect_Dispose(ArkUI_TransitionEffect* effect); 1146 1147 /** 1148 * @brief Sets a combination of transition effects. 1149 * 1150 * @param firstEffect Indicates the transition effect options. 1151 * @param secondEffect Indicates the combination of transition effects. 1152 * @return Returns the error code. 1153 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1154 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1155 * @since 12 1156 */ 1157 int32_t OH_ArkUI_TransitionEffect_Combine( 1158 ArkUI_TransitionEffect* firstEffect, ArkUI_TransitionEffect* secondEffect); 1159 1160 /** 1161 * @brief Sets transition effect animation settings. 1162 * 1163 * @note If <b>combine</b> is used for combining transition effects, the animation settings of a transition effect are 1164 * applicable to the one following it. 1165 * @param effect Indicates the transition effect options. 1166 * @param animation Indicates the animation settings. 1167 * @return Returns the error code. 1168 * Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful. 1169 * Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs. 1170 * @since 12 1171 */ 1172 int32_t OH_ArkUI_TransitionEffect_SetAnimation( 1173 ArkUI_TransitionEffect* effect, ArkUI_AnimateOption* animation); 1174 #ifdef __cplusplus 1175 }; 1176 #endif 1177 1178 #endif // ARKUI_NATIVE_ANIMATE_H