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