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