openharmony 鸿蒙 capi-native-animate-h

2026-08-25 浏览 (1)

native_animate.h

Overview

Defines a set of animation APIs of ArkUI on the native side. The APIs in native_animate.h must be called in the main thread.

File to include: <arkui/native_animate.h>

Library: libace_ndk.z.so

System capability: SystemCapability.ArkUI.ArkUI.Full

Since: 12

Related module: ArkUI_NativeModule

Sample: AnimationNDK

Summary

Structs

Nametypedef KeywordDescription
ArkUI_ExpectedFrameRateRangeArkUI_ExpectedFrameRateRangeDefines a struct for the expected frame rate range of the animation.
ArkUI_AnimateCompleteCallbackArkUI_AnimateCompleteCallbackDefines the callback type for when the animation playback is complete.
ArkUI_NativeAnimateAPI_1ArkUI_NativeAnimateAPI_1Defines a struct for the animation APIs of ArkUI on the native side.
ArkUI_AnimateOptionArkUI_AnimateOptionAnimation settings.
ArkUI_CurveArkUI_CurveDefines an interpolation curve.
ArkUI_Curve*ArkUI_CurveHandleDefines a struct for the pointer to an interpolation curve.
ArkUI_KeyframeAnimateOptionArkUI_KeyframeAnimateOptionDefines the keyframe animation parameter object.
ArkUI_AnimatorOptionArkUI_AnimatorOptionDefines the animator parameter object.
ArkUI_Animator*ArkUI_AnimatorHandleDefines the pointer to an animator object.
ArkUI_AnimatorEventArkUI_AnimatorEventDefines the animator callback event object.
ArkUI_AnimatorOnFrameEventArkUI_AnimatorOnFrameEventDefines the callback object when the animator receives a frame.
ArkUI_TransitionEffectArkUI_TransitionEffectDefines the transition effect.

Functions

NameDescription
ArkUI_AnimateOption* OH_ArkUI_AnimateOption_Create()Creates an animation configuration.
void OH_ArkUI_AnimateOption_Dispose(ArkUI_AnimateOption* option)Disposes of an animation configuration.
uint32_t OH_ArkUI_AnimateOption_GetDuration(ArkUI_AnimateOption* option)Obtains the animation duration, in milliseconds.
float OH_ArkUI_AnimateOption_GetTempo(ArkUI_AnimateOption* option)Obtains the playback speed of an animation.
ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option)Obtains an animation curve.
int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option)Obtains the animation delay, in milliseconds.
int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option)Obtains the number of times that an animation is played.
ArkUI_AnimationPlayMode OH_ArkUI_AnimateOption_GetPlayMode(ArkUI_AnimateOption* option)Obtains the playback mode of an animation.
ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(ArkUI_AnimateOption* option)Obtains the expected frame rate range of an animation.
void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value)Sets the animation duration, in milliseconds.
void OH_ArkUI_AnimateOption_SetTempo(ArkUI_AnimateOption* option, float value)Sets the playback speed of an animation.
void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_AnimationCurve value)Animation curve.
void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value)Sets the animation delay, in milliseconds.
void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value)Sets the number of times that an animation is played.
void OH_ArkUI_AnimateOption_SetPlayMode(ArkUI_AnimateOption* option, ArkUI_AnimationPlayMode value)Sets the playback mode for an animation.
void OH_ArkUI_AnimateOption_SetExpectedFrameRateRange(ArkUI_AnimateOption* option, ArkUI_ExpectedFrameRateRange* value)Defines a struct for the expected frame rate range of the animation.
void OH_ArkUI_AnimateOption_SetICurve(ArkUI_AnimateOption* option, ArkUI_CurveHandle value)Sets the animation curve for an animation.
ArkUI_CurveHandle OH_ArkUI_AnimateOption_GetICurve(ArkUI_AnimateOption* option)Obtains the animation curve of an animation.
ArkUI_KeyframeAnimateOption* OH_ArkUI_KeyframeAnimateOption_Create(int32_t size)Creates a keyframe animation parameter object.
void OH_ArkUI_KeyframeAnimateOption_Dispose(ArkUI_KeyframeAnimateOption* option)Disposes of a keyframe animation parameter object.
int32_t OH_ArkUI_KeyframeAnimateOption_SetDelay(ArkUI_KeyframeAnimateOption* option, int32_t value)Sets the overall delay of a keyframe animation, in milliseconds. By default, the keyframe animation starts without any delay.
int32_t OH_ArkUI_KeyframeAnimateOption_SetIterations(ArkUI_KeyframeAnimateOption* option, int32_t value)Sets the number of times that the keyframe animation is played. By default, the animation is played once. The value -1 indicates that the animation is played for an unlimited number of times. The value 0 indicates that no animation is played.
int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnFinishCallback(ArkUI_KeyframeAnimateOption* option, void* userData, void (*onFinish)()(void* userData))Sets the callback invoked when the keyframe animation playback is complete. This function is called after the keyframe animation has played for the specified number of times.
int32_t OH_ArkUI_KeyframeAnimateOption_SetExpectedFrameRate(ArkUI_KeyframeAnimateOption* option, ArkUI_ExpectedFrameRateRange* frameRate)Sets the expected frame rate for a keyframe animation.
int32_t OH_ArkUI_KeyframeAnimateOption_SetDuration(ArkUI_KeyframeAnimateOption* option, int32_t value, int32_t index)Sets the duration of a keyframe animation, in milliseconds.
int32_t OH_ArkUI_KeyframeAnimateOption_SetCurve(ArkUI_KeyframeAnimateOption* option, ArkUI_CurveHandle value, int32_t index)Sets the animation curve for a specific keyframe animation segment.
int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnEventCallback(ArkUI_KeyframeAnimateOption* option, void* userData, void (*event)(void* userData), int32_t index)Sets the closure function of the state at the time of the keyframe, that is, the state to be reached at the time of the keyframe.
int32_t OH_ArkUI_KeyframeAnimateOption_GetDelay(ArkUI_KeyframeAnimateOption* option)Obtains the overall delay of a keyframe animation, in milliseconds.
int32_t OH_ArkUI_KeyframeAnimateOption_GetIterations(ArkUI_KeyframeAnimateOption* option)Obtains the number of times that a keyframe animation is played.
ArkUI_ExpectedFrameRateRange* OH_ArkUI_KeyframeAnimateOption_GetExpectedFrameRate(ArkUI_KeyframeAnimateOption* option)Obtains the expected frame rate from keyframe animation parameters.
int32_t OH_ArkUI_KeyframeAnimateOption_GetDuration(ArkUI_KeyframeAnimateOption* option, int32_t index)Obtains the duration of a specific state in a keyframe animation, in milliseconds.
ArkUI_CurveHandle OH_ArkUI_KeyframeAnimateOption_GetCurve(ArkUI_KeyframeAnimateOption* option, int32_t index)Obtains the animation curve of a specific state in a keyframe animation.
ArkUI_AnimatorOption* OH_ArkUI_AnimatorOption_Create(int32_t keyframeSize)Creates an AnimatorOption object.
void OH_ArkUI_AnimatorOption_Dispose(ArkUI_AnimatorOption* option)Disposes of the animator parameters object.
int32_t OH_ArkUI_AnimatorOption_SetDuration(ArkUI_AnimatorOption* option, int32_t value)Sets the duration of the animator playback, in milliseconds.
int32_t OH_ArkUI_AnimatorOption_SetDelay(ArkUI_AnimatorOption* option, int32_t value)Sets the delay time of the animator playback, in milliseconds.
int32_t OH_ArkUI_AnimatorOption_SetIterations(ArkUI_AnimatorOption* option, int32_t value)Sets the number of times that an animator animation is played. By default, the animation is played once. The value -1 indicates that the animation is played for an unlimited number of times. The value 0 indicates that no animation is played.
int32_t OH_ArkUI_AnimatorOption_SetFill(ArkUI_AnimatorOption* option, ArkUI_AnimationFillMode value)Sets the status of the component before and after the animator animation execution.
int32_t OH_ArkUI_AnimatorOption_SetDirection(ArkUI_AnimatorOption* option, ArkUI_AnimationDirection value)Set the playback direction.
int32_t OH_ArkUI_AnimatorOption_SetCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value)Sets the interpolation curve for the animation of an animator.
int32_t OH_ArkUI_AnimatorOption_SetBegin(ArkUI_AnimatorOption* option, float value)Sets the interpolation start point of an animation.
int32_t OH_ArkUI_AnimatorOption_SetEnd(ArkUI_AnimatorOption* option, float value)Sets the interpolation end point for the animation of an animator.
int32_t OH_ArkUI_AnimatorOption_SetExpectedFrameRateRange(ArkUI_AnimatorOption* option, ArkUI_ExpectedFrameRateRange* value)Sets the expected frame rate range of an animator animation.
int32_t OH_ArkUI_AnimatorOption_SetKeyframe(ArkUI_AnimatorOption* option, float time, float value, int32_t index)Sets the keyframe parameters of an animator animation.
int32_t OH_ArkUI_AnimatorOption_SetKeyframeCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value, int32_t index)Sets the keyframe curve type for the animation of an animator.
int32_t OH_ArkUI_AnimatorOption_GetDuration(ArkUI_AnimatorOption* option)Obtains the duration for playing an animator animation.
int32_t OH_ArkUI_AnimatorOption_GetDelay(ArkUI_AnimatorOption* option)Obtains the delay for playing an animator animation.
int32_t OH_ArkUI_AnimatorOption_GetIterations(ArkUI_AnimatorOption* option)Obtains the number of times that an animator animation is played.
ArkUI_AnimationFillMode OH_ArkUI_AnimatorOption_GetFill(ArkUI_AnimatorOption* option)Obtains the status of the component before and after the animator animation execution.
ArkUI_AnimationDirection OH_ArkUI_AnimatorOption_GetDirection(ArkUI_AnimatorOption* option)Obtains the playback direction of an animator animation.
ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetCurve(ArkUI_AnimatorOption* option)Obtains the interpolation curve of an animator animation.
float OH_ArkUI_AnimatorOption_GetBegin(ArkUI_AnimatorOption* option)Obtains the interpolation start point of an animator animation.
float OH_ArkUI_AnimatorOption_GetEnd(ArkUI_AnimatorOption* option)Obtains the interpolation end point of an animator animation.
ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimatorOption_GetExpectedFrameRateRange(ArkUI_AnimatorOption* option)Obtains the expected frame rate range of an animator animation.
float OH_ArkUI_AnimatorOption_GetKeyframeTime(ArkUI_AnimatorOption* option, int32_t index)Obtains the keyframe time of the animator playback, in milliseconds.
float OH_ArkUI_AnimatorOption_GetKeyframeValue(ArkUI_AnimatorOption* option, int32_t index)Obtains the keyframe value of an animation.
ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetKeyframeCurve(ArkUI_AnimatorOption* option, int32_t index)Obtains the interpolation curve for a keyframe in the animation of an animator.
void* OH_ArkUI_AnimatorEvent_GetUserData(ArkUI_AnimatorEvent* event)Obtains the custom object in an animation event object.
void* OH_ArkUI_AnimatorOnFrameEvent_GetUserData(ArkUI_AnimatorOnFrameEvent* event)Obtains the user-defined object in the frame event of an animation.
float OH_ArkUI_AnimatorOnFrameEvent_GetValue(ArkUI_AnimatorOnFrameEvent* event)Obtains the interpolation result in the animation frame callback event object.
int32_t OH_ArkUI_AnimatorOption_RegisterOnFrameCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorOnFrameEvent* event))Sets the callback invoked when the animator receives a frame.
int32_t OH_ArkUI_AnimatorOption_RegisterOnFinishCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))Sets the callback invoked when the animation playback is complete.
int32_t OH_ArkUI_AnimatorOption_RegisterOnCancelCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))Sets the callback invoked when the animation playback is canceled.
int32_t OH_ArkUI_AnimatorOption_RegisterOnRepeatCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))Sets the callback invoked when the animation playback is repeated.
int32_t OH_ArkUI_Animator_ResetAnimatorOption(ArkUI_AnimatorHandle animatorHandle, ArkUI_AnimatorOption* option)Resets the animation of an animator.
int32_t OH_ArkUI_Animator_Play(ArkUI_AnimatorHandle animatorHandle)Starts the animation of an animator.
int32_t OH_ArkUI_Animator_Finish(ArkUI_AnimatorHandle animatorHandle)Ends the animation of an animator.
int32_t OH_ArkUI_Animator_Pause(ArkUI_AnimatorHandle animatorHandle)Pauses the animation of an animator.
int32_t OH_ArkUI_Animator_Cancel(ArkUI_AnimatorHandle animatorHandle)Cancels the animation of an animator.
int32_t OH_ArkUI_Animator_Reverse(ArkUI_AnimatorHandle animatorHandle)Plays this animation in reverse order.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateCurveByType(ArkUI_AnimationCurve curve)Implements initialization for the interpolation curve, which is used to create an interpolation curve based on the input parameter.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateStepsCurve(int32_t count, bool end)Creates a step curve.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateCubicBezierCurve(float x1, float y1, float x2, float y2)Creates a cubic Bezier curve.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringCurve(float velocity, float mass, float stiffness, float damping)Creates a spring curve. The curve shape is determined by the spring parameters, and the animation duration is controlled by the duration parameter in animation and animateTo.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringMotion(float response, float dampingFraction, float overlapDuration)Creates a spring animation curve. If multiple spring animations are applied to the same attribute of an object, each animation replaces their predecessor and inherits the velocity.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateResponsiveSpringMotion(float response, float dampingFraction, float overlapDuration)Creates a responsive spring animation curve. It is a special case of springMotion, with the only difference in the default values. It can be used together with springMotion.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateInterpolatingSpring(float velocity, float mass, float stiffness, float damping)Creates an interpolating spring curve animated from 0 to 1. The actual animation value is calculated based on the curve.
ArkUI_CurveHandle OH_ArkUI_Curve_CreateCustomCurve(void* userData, float (*interpolate)(float fraction, void* userdata))Creates a custom curve.
void OH_ArkUI_Curve_DisposeCurve(ArkUI_CurveHandle curveHandle)Disposes of a custom curve.
ArkUI_TransitionEffect* OH_ArkUI_CreateOpacityTransitionEffect(float opacity)Creates an opacity object for component transition.
ArkUI_TransitionEffect* OH_ArkUI_CreateTranslationTransitionEffect(ArkUI_TranslationOptions* translate)Creates a translation effect object for component transition.
ArkUI_TransitionEffect* OH_ArkUI_CreateScaleTransitionEffect(ArkUI_ScaleOptions* scale)Creates a scaling object for component transition.
ArkUI_TransitionEffect* OH_ArkUI_CreateRotationTransitionEffect(ArkUI_RotationOptions* rotate)Creates a rotation effect object for component transition.
ArkUI_TransitionEffect* OH_ArkUI_CreateMovementTransitionEffect(ArkUI_TransitionEdge edge)Creates a movement object for component transition.
ArkUI_TransitionEffect* OH_ArkUI_CreateAsymmetricTransitionEffect(ArkUI_TransitionEffect* appear, ArkUI_TransitionEffect* disappear)Creates an asymmetric transition effect.
void OH_ArkUI_TransitionEffect_Dispose(ArkUI_TransitionEffect* effect)Disposes of a transition effect.
int32_t OH_ArkUI_TransitionEffect_Combine(ArkUI_TransitionEffect* firstEffect, ArkUI_TransitionEffect* secondEffect)Sets a combination of transition effects.
int32_t OH_ArkUI_TransitionEffect_SetAnimation(ArkUI_TransitionEffect* effect, ArkUI_AnimateOption* animation)Sets transition effect animation settings.

Function Description

OH_ArkUI_AnimateOption_Create()

ArkUI_AnimateOption* OH_ArkUI_AnimateOption_Create()

Description

Creates an animation configuration.

Since: 12

Return value

TypeDescription
ArkUI_AnimateOption*Pointer to the created animation configuration.

OH_ArkUI_AnimateOption_Dispose()

void OH_ArkUI_AnimateOption_Dispose(ArkUI_AnimateOption* option)

Description

Disposes of an animation configuration.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.

OH_ArkUI_AnimateOption_GetDuration()

uint32_t OH_ArkUI_AnimateOption_GetDuration(ArkUI_AnimateOption* option)

Description

Obtains the animation duration, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
uint32_tAnimation duration, in milliseconds. If option is invalid, 0 is returned.

OH_ArkUI_AnimateOption_GetTempo()

float OH_ArkUI_AnimateOption_GetTempo(ArkUI_AnimateOption* option)

Description

Obtains the playback speed of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, 0.0 is returned.

Return value

TypeDescription
floatAnimation playback speed. Value range: [0, +∞). If option is invalid, 0.0 is returned.

OH_ArkUI_AnimateOption_GetCurve()

ArkUI_AnimationCurve OH_ArkUI_AnimateOption_GetCurve(ArkUI_AnimateOption* option)

Description

Obtains an animation curve.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, -1 is returned.

Return value

TypeDescription
ArkUI_AnimationCurveAnimation curve. If option is invalid,-1 is returned.

OH_ArkUI_AnimateOption_GetDelay()

int32_t OH_ArkUI_AnimateOption_GetDelay(ArkUI_AnimateOption* option)

Description

Obtains the animation delay, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tDelay of animation playback. If option is invalid, 0 is returned.

OH_ArkUI_AnimateOption_GetIterations()

int32_t OH_ArkUI_AnimateOption_GetIterations(ArkUI_AnimateOption* option)

Description

Obtains the number of times that an animation is played.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tNumber of times that the animation is played. If option is invalid, 0 is returned.

OH_ArkUI_AnimateOption_GetPlayMode()

ArkUI_AnimationPlayMode OH_ArkUI_AnimateOption_GetPlayMode(ArkUI_AnimateOption* option)

Description

Obtains the playback mode of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, -1 is returned.

Return value

TypeDescription
ArkUI_AnimationPlayModeAnimation playback mode. If option is invalid,-1 is returned.

OH_ArkUI_AnimateOption_GetExpectedFrameRateRange()

ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimateOption_GetExpectedFrameRateRange(ArkUI_AnimateOption* option)

Description

Obtains the expected frame rate range of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, NULL is returned.

Return value

TypeDescription
ArkUI_ExpectedFrameRateRange*Expected frame rate range of the animation, in fps. If option is invalid, NULL is returned.

OH_ArkUI_AnimateOption_SetDuration()

void OH_ArkUI_AnimateOption_SetDuration(ArkUI_AnimateOption* option, int32_t value)

Description

Sets the animation duration, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
int32_t valueAnimation duration, in milliseconds. Value range: [0, +∞).
If the value is less than 0, 0 is used.

OH_ArkUI_AnimateOption_SetTempo()

void OH_ArkUI_AnimateOption_SetTempo(ArkUI_AnimateOption* option, float value)

Description

Sets the playback speed of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
float valueAnimation playback speed. Value range: [0, +∞).
NOTE
If the value is less than 0, the default value 1 is used.

OH_ArkUI_AnimateOption_SetCurve()

void OH_ArkUI_AnimateOption_SetCurve(ArkUI_AnimateOption* option, ArkUI_AnimationCurve value)

Description

Animation curve.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
ArkUI_AnimationCurve valueAnimation curve. Default value: ARKUI_CURVE_LINEAR. You are advised to use ARKUI_CURVE_EASE_IN_OUT to obtain a smoother animation effect.
If the value is abnormal, the setting is invalid.

OH_ArkUI_AnimateOption_SetDelay()

void OH_ArkUI_AnimateOption_SetDelay(ArkUI_AnimateOption* option, int32_t value)

Description

Sets the animation delay, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
int32_t valueAnimation delay, in milliseconds. Value range: (-∞, +∞). Default value: 0, indicating no animation delay. A value greater than 0 means to begin the animation after the specified amount of time has elapsed. A value less than 0 means to begin the animation in advance. If value is less than 0 and the absolute value of value is less than the actual animation duration, the animation starts its first frame from the state at the absolute value. If the absolute value of value is greater than or equal to the actual animation duration, the animation starts its first frame from the end state. The actual animation duration is equal to the duration of a single animation multiplied by the number of animation playback times.

OH_ArkUI_AnimateOption_SetIterations()

void OH_ArkUI_AnimateOption_SetIterations(ArkUI_AnimateOption* option, int32_t value)

Description

Sets the number of times that an animation is played.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
int32_t valueNumber of times that the animation is played. Value range: [-1, +∞). If this parameter is set to 0, the animation is not played. If this parameter is set to -1, the animation is played for an infinite number of times. Default value: 1 (played once).
If the value is less than -1, the operation is invalid.

OH_ArkUI_AnimateOption_SetPlayMode()

void OH_ArkUI_AnimateOption_SetPlayMode(ArkUI_AnimateOption* option, ArkUI_AnimationPlayMode value)

Description

Sets the playback mode for an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
ArkUI_AnimationPlayMode valueAnimation playback mode. Default value: ARKUI_ANIMATION_PLAY_MODE_NORMAL.
If the value is abnormal, the operation is invalid.

OH_ArkUI_AnimateOption_SetExpectedFrameRateRange()

void OH_ArkUI_AnimateOption_SetExpectedFrameRateRange(ArkUI_AnimateOption* option, ArkUI_ExpectedFrameRateRange* value)

Description

Defines a struct for the expected frame rate range of the animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionPointer to an animation configuration.
If option is set to NULL, the operation is invalid.
ArkUI_ExpectedFrameRateRange* valueExpected frame rate range of the animation, in fps.
If value is set to NULL, the operation is invalid.

OH_ArkUI_AnimateOption_SetICurve()

void OH_ArkUI_AnimateOption_SetICurve(ArkUI_AnimateOption* option, ArkUI_CurveHandle value)

Description

Sets the animation curve for an animation.

NOTE

This API takes precedence over OH_ArkUI_AnimateOption_SetCurve.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionAnimator animation parameters.
If option is set to NULL, the operation is invalid.
ArkUI_CurveHandle valueAnimation curve parameters.
If value is set to NULL, the operation is invalid.

OH_ArkUI_AnimateOption_GetICurve()

ArkUI_CurveHandle OH_ArkUI_AnimateOption_GetICurve(ArkUI_AnimateOption* option)

Description

Obtains the animation curve of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimateOption* optionAnimator animation parameters.
If option is set to NULL, NULL is returned.

Return value

TypeDescription
ArkUI_CurveHandleAnimation curve parameters. Returns NULL if the option parameter is invalid.

OH_ArkUI_KeyframeAnimateOption_Create()

ArkUI_KeyframeAnimateOption* OH_ArkUI_KeyframeAnimateOption_Create(int32_t size)

Description

Creates a keyframe animation parameter object.

Since: 12

Parameters

NameDescription
int32_t sizeNumber of keyframe animation states.
Returns NULL if the value of size is less than 0.

Return value

TypeDescription
ArkUI_KeyframeAnimateOption*Keyframe animation parameter object. If the value of size is less than 0 or if option is abnormal, NULL is returned.

OH_ArkUI_KeyframeAnimateOption_Dispose()

void OH_ArkUI_KeyframeAnimateOption_Dispose(ArkUI_KeyframeAnimateOption* option)

Description

Disposes of a keyframe animation parameter object.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameter object.
If option is set to NULL, the operation is invalid.

OH_ArkUI_KeyframeAnimateOption_SetDelay()

int32_t OH_ArkUI_KeyframeAnimateOption_SetDelay(ArkUI_KeyframeAnimateOption* option, int32_t value)

Description

Sets the overall delay of a keyframe animation, in milliseconds. By default, the keyframe animation starts without any delay.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valueAnimation delay, in milliseconds. Value range: (-∞, +∞). Default value: 0, indicating no animation delay. A value greater than 0 means to begin the animation after the specified amount of time has elapsed. A value less than 0 means to begin the animation in advance. If value is less than 0 and the absolute value of value is less than the actual animation duration, the animation starts its first frame from the state at the absolute value. If the absolute value of value is greater than or equal to the actual animation duration, the animation starts its first frame from the end state. The actual animation duration is equal to the duration of a single animation multiplied by the number of animation playback times.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_SetIterations()

int32_t OH_ArkUI_KeyframeAnimateOption_SetIterations(ArkUI_KeyframeAnimateOption* option, int32_t value)

Description

Sets the number of times that the keyframe animation is played. By default, the animation is played once. The value -1 indicates that the animation is played for an unlimited number of times. The value 0 indicates that no animation is played.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valueNumber of times that the animation is played. Value range: [-1, +∞). If this parameter is set to 0, the animation is not played. If this parameter is set to -1, the animation is played for an infinite number of times. Default value: 1, indicating that the animation is played once.
If the value is less than -1, the operation is invalid, and the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_RegisterOnFinishCallback()

int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnFinishCallback(ArkUI_KeyframeAnimateOption* option, void* userData, void (*onFinish)(void* userData))

Description

Sets the callback invoked when the keyframe animation playback is complete. This function is called after the keyframe animation has played for the specified number of times.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
void* userDataPointer to a custom object.
Abnormal value processing is not involved.
void (*onFinish)(void* userData)Callback function.
userData: input parameter of the callback function, a user-defined object pointer.
If onFinish is set to NULL, the operation is invalid.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_SetExpectedFrameRate()

int32_t OH_ArkUI_KeyframeAnimateOption_SetExpectedFrameRate(ArkUI_KeyframeAnimateOption* option, ArkUI_ExpectedFrameRateRange* frameRate)

Description

Sets the expected frame rate for a keyframe animation.

Since: 19

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_ExpectedFrameRateRange* frameRateExpected frame rate for the keyframe animation.
If frameRate is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_SetDuration()

int32_t OH_ArkUI_KeyframeAnimateOption_SetDuration(ArkUI_KeyframeAnimateOption* option, int32_t value, int32_t index)

Description

Sets the duration of a keyframe animation, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valueKeyframe animation duration, in ms. The default value is 1000 ms. Value range: [0, +∞).
If the value is less than 0, 0 is used.
int32_t indexIndex of the keyframe state segment.
If the value of index is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_SetCurve()

int32_t OH_ArkUI_KeyframeAnimateOption_SetCurve(ArkUI_KeyframeAnimateOption* option, ArkUI_CurveHandle value, int32_t index)

Description

Sets the animation curve for a specific keyframe animation segment.

NOTE

Because the duration of the springMotion, responsiveSpringMotion, and interpolatingSpring curves does not take effect, these curves are not supported.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_CurveHandle valueAnimation curve to set. Default value: ARKUI_CURVE_EASE_IN_OUT.
int32_t indexIndex of the keyframe state segment. Value range: [0, size – 1], where size indicates the number of keyframe animation states.
If the value of index is less than 0 or out of range, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_RegisterOnEventCallback()

int32_t OH_ArkUI_KeyframeAnimateOption_RegisterOnEventCallback(ArkUI_KeyframeAnimateOption* option, void* userData, void (*event)(void* userData), int32_t index)

Description

Sets the closure function of the state at the time of the keyframe, that is, the state to be reached at the time of the keyframe.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
void* userDataPointer to a user-defined object.
Abnormal value processing is not involved.
void (*event)(void* userData)Closure function.
If event is set to NULL, the operation is invalid.
int32_t indexIndex of the keyframe state segment. Value range: [0, size – 1], where size indicates the number of keyframe animation states.
If the value of index is less than 0 or out of range, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_KeyframeAnimateOption_GetDelay()

int32_t OH_ArkUI_KeyframeAnimateOption_GetDelay(ArkUI_KeyframeAnimateOption* option)

Description

Obtains the overall delay of a keyframe animation, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tOverall delay, in milliseconds. If option is invalid, 0 is returned.

OH_ArkUI_KeyframeAnimateOption_GetIterations()

int32_t OH_ArkUI_KeyframeAnimateOption_GetIterations(ArkUI_KeyframeAnimateOption* option)

Description

Obtains the number of times that a keyframe animation is played.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tNumber of times that the animation is played. If option is invalid, 0 is returned.

OH_ArkUI_KeyframeAnimateOption_GetExpectedFrameRate()

ArkUI_ExpectedFrameRateRange* OH_ArkUI_KeyframeAnimateOption_GetExpectedFrameRate(ArkUI_KeyframeAnimateOption* option)

Description

Obtains the expected frame rate from keyframe animation parameters.

Since: 19

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, NULL is returned.

Return value

TypeDescription
ArkUI_ExpectedFrameRateRange*Returns the expected frame rate obtained. If option is invalid, NULL is returned.

OH_ArkUI_KeyframeAnimateOption_GetDuration()

int32_t OH_ArkUI_KeyframeAnimateOption_GetDuration(ArkUI_KeyframeAnimateOption* option, int32_t index)

Description

Obtains the duration of a specific state in a keyframe animation, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, 0 is returned.
int32_t indexIndex of the keyframe state segment.
If the value of index is less than 0, 0 is returned.

Return value

TypeDescription
int32_tDuration, in milliseconds. If option is invalid, 0 is returned.

OH_ArkUI_KeyframeAnimateOption_GetCurve()

ArkUI_CurveHandle OH_ArkUI_KeyframeAnimateOption_GetCurve(ArkUI_KeyframeAnimateOption* option, int32_t index)

Description

Obtains the animation curve of a specific state in a keyframe animation.

Since: 12

Parameters

NameDescription
ArkUI_KeyframeAnimateOption* optionKeyframe animation parameters.
If option is set to NULL, NULL is returned.
int32_t indexIndex of the keyframe state segment.
If the value of index is less than 0, NULL is returned.

Return value

TypeDescription
ArkUI_CurveHandleAnimation curve. If the parameter is abnormal, NULL is returned.

OH_ArkUI_AnimatorOption_Create()

ArkUI_AnimatorOption* OH_ArkUI_AnimatorOption_Create(int32_t keyframeSize)

Description

Creates an AnimatorOption object.

NOTE

If the value of keyframeSize is greater than 0, the animation interpolation start point is 0, and the animation interpolation end point is 1; no setting is allowed.

Since: 12

Parameters

NameDescription
int32_t keyframeSizeNumber of keyframes.
If the value of keyframeSize is less than 0, NULL is returned.

Return value

TypeDescription
ArkUI_AnimatorOption*Pointer to the animator parameter object. If the value of size is less than 0 or if option is abnormal, NULL is returned.

OH_ArkUI_AnimatorOption_Dispose()

void OH_ArkUI_AnimatorOption_Dispose(ArkUI_AnimatorOption* option)

Description

Disposes of an AnimatorOption object.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the operation is invalid.

OH_ArkUI_AnimatorOption_SetDuration()

int32_t OH_ArkUI_AnimatorOption_SetDuration(ArkUI_AnimatorOption* option, int32_t value)

Description

Sets the duration of an animator animation, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valuePlayback duration, in ms. The default value is 0 ms. Value range: [0, +∞).
If the value is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetDelay()

int32_t OH_ArkUI_AnimatorOption_SetDelay(ArkUI_AnimatorOption* option, int32_t value)

Description

Sets the delay time of the animator playback, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valueAnimation delay, in milliseconds. Value range: (-∞, +∞). Default value: 0, indicating no animation delay. A value greater than 0 means to begin the animation after the specified amount of time has elapsed. A value less than 0 means to begin the animation in advance. If value is less than 0 and the absolute value of value is less than the actual animation duration, the animation starts its first frame from the state at the absolute value. If the absolute value of value is greater than or equal to the actual animation duration, the animation starts its first frame from the end state. The actual animation duration is equal to the duration of a single animation multiplied by the number of animation playback times.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetIterations()

int32_t OH_ArkUI_AnimatorOption_SetIterations(ArkUI_AnimatorOption* option, int32_t value)

Description

Sets the number of times that an animator animation is played. By default, the animation is played once. The value -1 indicates that the animation is played for an unlimited number of times. The value 0 indicates that no animation is played.

NOTE

If this parameter is set to a negative value other than -1, the value is invalid. In this case, the animation is played once.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
int32_t valueValue range: [-1, +∞). If this parameter is set to 0, the animation is not played. If this parameter is set to -1, the animation is played for an infinite number of times. Default value: 1 (played once).
If the value is less than -1, the operation is invalid.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetFill()

int32_t OH_ArkUI_AnimatorOption_SetFill(ArkUI_AnimatorOption* option, ArkUI_AnimationFillMode value)

Description

Sets the status of the component before and after the animator animation execution.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_AnimationFillMode valueStatus of the component before and after the animator animation execution. Default value: ARKUI_ANIMATION_FILL_MODE_FORWARDS.
If the value is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetDirection()

int32_t OH_ArkUI_AnimatorOption_SetDirection(ArkUI_AnimatorOption* option, ArkUI_AnimationDirection value)

Description

Set the playback direction.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_AnimationDirection valueAnimation playback direction.
If the value is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetCurve()

int32_t OH_ArkUI_AnimatorOption_SetCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value)

Description

Sets the interpolation curve for the animation of an animator.

NOTE

The springCurve, springMotion, responsiveSpringMotion, interpolatingSpring, and customCurve animation curves are not supported.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_CurveHandle valueInterpolation curve. Default value: ARKUI_CURVE_LINEAR. You are advised to use ARKUI_CURVE_EASE_IN_OUT to obtain a smoother animation effect.
If value is set to NULL, the default curve ARKUI_CURVE_LINEAR is used.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetBegin()

int32_t OH_ArkUI_AnimatorOption_SetBegin(ArkUI_AnimatorOption* option, float value)

Description

Sets the interpolation start point of an animation.

NOTE

This API does not take effect when the animation is a keyframe animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
float valueInterpolation start point of the animation. Value range: (-∞, +∞).

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetEnd()

int32_t OH_ArkUI_AnimatorOption_SetEnd(ArkUI_AnimatorOption* option, float value)

Description

Sets the interpolation end point for the animation of an animator.

NOTE

This API does not take effect when the animation is a keyframe animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
float valueInterpolation end point of the animation. Value range: (-∞, +∞).

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetExpectedFrameRateRange()

int32_t OH_ArkUI_AnimatorOption_SetExpectedFrameRateRange(ArkUI_AnimatorOption* option, ArkUI_ExpectedFrameRateRange* value)

Description

Sets the expected frame rate range of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_ExpectedFrameRateRange* valueExpected frame rate range.
If value is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetKeyframe()

int32_t OH_ArkUI_AnimatorOption_SetKeyframe(ArkUI_AnimatorOption* option, float time, float value, int32_t index)

Description

Sets the keyframe parameters of an animator animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
float timeKeyframe time. Value range: [0, 1]. The value must be in ascending order. Default value: evenly distributed by index (for example, 0.0 for the first frame, 0.5 for the second frame, and 1.0 for the third frame).
If the value of time is less than 0 or greater than 1, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
float valueKeyframe value. Value range: (-∞, +∞).
int32_t indexKeyframe index.
If the value of index is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_SetKeyframeCurve()

int32_t OH_ArkUI_AnimatorOption_SetKeyframeCurve(ArkUI_AnimatorOption* option, ArkUI_CurveHandle value, int32_t index)

Description

Sets the keyframe curve type for the animation of an animator.

NOTE

The springCurve, springMotion, responsiveSpringMotion, interpolatingSpring, and customCurve animation curves are not supported.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
If option is set to NULL, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.
ArkUI_CurveHandle valueInterpolation curve. Default value: NULL, indicating linear interpolation.
int32_t indexKeyframe index.
If the value of index is less than 0, the error code ARKUI_ERROR_CODE_PARAM_INVALID is returned.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_GetDuration()

int32_t OH_ArkUI_AnimatorOption_GetDuration(ArkUI_AnimatorOption* option)

Description

Obtains the duration for playing an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.
If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tDuration for playing the animation, in milliseconds. If option is invalid, 0 is returned.

OH_ArkUI_AnimatorOption_GetDelay()

int32_t OH_ArkUI_AnimatorOption_GetDelay(ArkUI_AnimatorOption* option)

Description

Obtains the delay for playing an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters. If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tDelay for playing the animation, in milliseconds. If option is invalid, 0 is returned.

OH_ArkUI_AnimatorOption_GetIterations()

int32_t OH_ArkUI_AnimatorOption_GetIterations(ArkUI_AnimatorOption* option)

Description

Obtains the number of times that an animator animation is played.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters. If option is set to NULL, 0 is returned.

Return value

TypeDescription
int32_tNumber of times that the animation is played. If option is invalid, 0 is returned.

OH_ArkUI_AnimatorOption_GetFill()

ArkUI_AnimationFillMode OH_ArkUI_AnimatorOption_GetFill(ArkUI_AnimatorOption* option)

Description

Obtains the status of the component before and after the animator animation execution.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
ArkUI_AnimationFillModeStatus of the component before and after the animator animation execution. If option is invalid,-1 is returned.

OH_ArkUI_AnimatorOption_GetDirection()

ArkUI_AnimationDirection OH_ArkUI_AnimatorOption_GetDirection(ArkUI_AnimatorOption* option)

Description

Obtains the playback direction of an animator animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
ArkUI_AnimationDirectionAnimation playback direction. If option is invalid,-1 is returned.

OH_ArkUI_AnimatorOption_GetCurve()

ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetCurve(ArkUI_AnimatorOption* option)

Description

Obtains the interpolation curve of the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
ArkUI_CurveHandleInterpolation curve. If option is invalid, NULL is returned.

OH_ArkUI_AnimatorOption_GetBegin()

float OH_ArkUI_AnimatorOption_GetBegin(ArkUI_AnimatorOption* option)

Description

Obtains the interpolation start point of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
floatInterpolation start point of the animation. If option is invalid, 0.0 is returned.

OH_ArkUI_AnimatorOption_GetEnd()

float OH_ArkUI_AnimatorOption_GetEnd(ArkUI_AnimatorOption* option)

Description

Obtains the interpolation end point of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
floatInterpolation end point of the animation. If option is invalid, 0.0 is returned.

OH_ArkUI_AnimatorOption_GetExpectedFrameRateRange()

ArkUI_ExpectedFrameRateRange* OH_ArkUI_AnimatorOption_GetExpectedFrameRateRange(ArkUI_AnimatorOption* option)

Description

Obtains the expected frame rate range of an animator animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
ArkUI_ExpectedFrameRateRange*Pointer to the expected frame rate range object. Returns NULL if a parameter error occurs.

OH_ArkUI_AnimatorOption_GetKeyframeTime()

float OH_ArkUI_AnimatorOption_GetKeyframeTime(ArkUI_AnimatorOption* option, int32_t index)

Description

Obtains the keyframe time of the animator playback, in milliseconds.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
int32_t indexKeyframe index.

Return value

TypeDescription
floatKeyframe time, in milliseconds.

OH_ArkUI_AnimatorOption_GetKeyframeValue()

float OH_ArkUI_AnimatorOption_GetKeyframeValue(ArkUI_AnimatorOption* option, int32_t index)

Description

Obtains the keyframe value of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
int32_t indexKeyframe index.

Return value

TypeDescription
floatKeyframe value.

OH_ArkUI_AnimatorOption_GetKeyframeCurve()

ArkUI_CurveHandle OH_ArkUI_AnimatorOption_GetKeyframeCurve(ArkUI_AnimatorOption* option, int32_t index)

Description

Obtains the interpolation curve for a keyframe in the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator parameters.
int32_t indexKeyframe index.

Return value

TypeDescription
ArkUI_CurveHandleInterpolation curve. Returns NULL if a parameter error occurs.

OH_ArkUI_AnimatorEvent_GetUserData()

void* OH_ArkUI_AnimatorEvent_GetUserData(ArkUI_AnimatorEvent* event)

Description

Obtains the user-defined object in an animation event object.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorEvent* eventAnimation event object.

Return value

TypeDescription
void*User-defined object.

OH_ArkUI_AnimatorOnFrameEvent_GetUserData()

void* OH_ArkUI_AnimatorOnFrameEvent_GetUserData(ArkUI_AnimatorOnFrameEvent* event)

Description

Obtains the user-defined object in the frame event of an animation.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOnFrameEvent* eventAnimation event object.

Return value

TypeDescription
void*User-defined object.

OH_ArkUI_AnimatorOnFrameEvent_GetValue()

float OH_ArkUI_AnimatorOnFrameEvent_GetValue(ArkUI_AnimatorOnFrameEvent* event)

Description

Obtains the interpolation result in the animation frame callback event object.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOnFrameEvent* eventAnimation event object.

Return value

TypeDescription
floatAnimation interpolation result.
NOTE
During the animation, the interpolation result changes between the interpolation start point OH_ArkUI_AnimatorOption_SetBegin and the interpolation end point OH_ArkUI_AnimatorOption_SetEnd based on the animation parameters.

OH_ArkUI_AnimatorOption_RegisterOnFrameCallback()

int32_t OH_ArkUI_AnimatorOption_RegisterOnFrameCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorOnFrameEvent* event))

Description

Sets the callback invoked when the animator receives a frame.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.
void* userDataUser-defined parameter.
void (*callback)(ArkUI_AnimatorOnFrameEvent* event)Callback function.
- event: input parameter of the callback function, an animation event object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_RegisterOnFinishCallback()

int32_t OH_ArkUI_AnimatorOption_RegisterOnFinishCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))

Description

Sets the callback invoked when the animation playback is complete.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.
void* userDataUser-defined parameter.
void (*callback)(ArkUI_AnimatorEvent* event)Callback function.
- event: input parameter of the callback function, an animation event object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_RegisterOnCancelCallback()

int32_t OH_ArkUI_AnimatorOption_RegisterOnCancelCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))

Description

Sets the callback invoked when the animation playback is canceled.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.
void* userDataUser-defined parameter.
void (*callback)(ArkUI_AnimatorEvent* event)Callback function.
- event: input parameter of the callback function, an animation event object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_AnimatorOption_RegisterOnRepeatCallback()

int32_t OH_ArkUI_AnimatorOption_RegisterOnRepeatCallback(ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event))

Description

Sets the callback invoked when the animation playback is repeated.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorOption* optionAnimator animation parameters.
void* userDataUser-defined parameter.
void (*callback)(ArkUI_AnimatorEvent* event)Callback function.
- event: input parameter of the callback function, an animation event object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_ResetAnimatorOption()

int32_t OH_ArkUI_Animator_ResetAnimatorOption(ArkUI_AnimatorHandle animatorHandle, ArkUI_AnimatorOption* option)

Description

Resets the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.
ArkUI_AnimatorOption* optionAnimator animation parameters.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_Play()

int32_t OH_ArkUI_Animator_Play(ArkUI_AnimatorHandle animatorHandle)

Description

Starts the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_Finish()

int32_t OH_ArkUI_Animator_Finish(ArkUI_AnimatorHandle animatorHandle)

Description

Ends the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_Pause()

int32_t OH_ArkUI_Animator_Pause(ArkUI_AnimatorHandle animatorHandle)

Description

Pauses the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_Cancel()

int32_t OH_ArkUI_Animator_Cancel(ArkUI_AnimatorHandle animatorHandle)

Description

Cancels the animation of an animator.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Animator_Reverse()

int32_t OH_ArkUI_Animator_Reverse(ArkUI_AnimatorHandle animatorHandle)

Description

Plays this animation in reverse order.

Since: 12

Parameters

NameDescription
ArkUI_AnimatorHandle animatorHandleAnimator object.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_Curve_CreateCurveByType()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateCurveByType(ArkUI_AnimationCurve curve)

Description

Implements initialization for the interpolation curve, which is used to create an interpolation curve based on the input parameter.

Since: 12

Parameters

NameDescription
ArkUI_AnimationCurve curveCurve type.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateStepsCurve()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateStepsCurve(int32_t count, bool end)

Description

Creates a step curve.

Since: 12

Parameters

NameDescription
int32_t countNumber of steps. The value must be a positive integer. Value range: [1, +∞).
If the value of count is abnormal, the operation is invalid.
bool endWhether the step change occurs at the start or end of each interval. true: The step change occurs at the end of each interval. false: The step change occurs at the start of each interval.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateCubicBezierCurve()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateCubicBezierCurve(float x1, float y1, float x2, float y2)

Description

Creates a cubic Bezier curve.

Since: 12

Parameters

NameDescription
float x1X-coordinate of the first point on the Bezier curve. Value range: [0, 1]. A value less than 0 is treated as 0. A value greater than 1 is treated as 1.
float y1Y-coordinate of the first point on the Bezier curve.
float x2X-coordinate of the second point on the Bezier curve. Value range: [0, 1]. A value less than 0 is treated as 0. A value greater than 1 is treated as 1.
float y2Y-coordinate of the second point on the Bezier curve.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateSpringCurve()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringCurve(float velocity, float mass, float stiffness, float damping)

Description

Creates a spring curve. The curve shape is determined by the spring parameters, and the animation duration is controlled by the duration parameter in animation and animateTo.

Since: 12

Parameters

NameDescription
float velocityInitial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value.
float massMass. It describes the inertia of the object in the elastic system, affecting the amplitude of oscillation and the speed of return to equilibrium. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.
float stiffnessStiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.
float dampingDamping. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateSpringMotion()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateSpringMotion(float response, float dampingFraction, float overlapDuration)

Description

Creates a spring animation curve. If multiple spring animations are applied to the same attribute of an object, each animation replaces their predecessor and inherits the velocity.

NOTE

The animation duration determined by the curve parameters, rather than the duration parameter in animation or animateTo.

Since: 12

Parameters

NameDescription
float responseDuration of one complete oscillation. Value range: (0, +∞).
If the value is less than or equal to 0, 0.55 is used.
float dampingFractionDamping coefficient. > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. 1: critically damped. > 1: overdamped. In this case, the spring approaches equilibrium gradually. Value range: (0, +∞).
If the value is less than or equal to 0, 0.825 is used.
float overlapDurationDuration for animations to overlap, in seconds. When animations overlap, the response values of these animations will transit smoothly over this duration if they are different. Value range: [0, +∞).
If the value is less than 0, 0 is used.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateResponsiveSpringMotion()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateResponsiveSpringMotion(float response, float dampingFraction, float overlapDuration)

Description

Creates a responsive spring animation curve. It is a special case of springMotion, with the only difference in the default values. It can be used together with springMotion.

NOTE

The animation duration determined by the curve parameters, rather than the duration parameter in animation or animateTo.

Since: 12

Parameters

NameDescription
float responseDuration of one complete oscillation. Value range: (0, +∞).
If the value is less than or equal to 0, 0.15 is used.
float dampingFractionDamping coefficient. > 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position. 1: critically damped. > 1: overdamped. In this case, the spring approaches equilibrium gradually. Value range: [0, +∞).
If the value is less than 0, 0.86 is used.
float overlapDurationDuration for animations to overlap, in seconds. When animations overlap, the response values of these animations will transit smoothly over this duration if they are different. Value range: [0, +∞).
If the value is less than 0, 0.25 is used.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateInterpolatingSpring()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateInterpolatingSpring(float velocity, float mass, float stiffness, float damping)

Description

Creates an interpolating spring curve animated from 0 to 1. The actual animation value is calculated based on the curve.

NOTE

The animation duration determined by the curve parameters, rather than the duration parameter in animation or animateTo.

Since: 12

Parameters

NameDescription
float velocityInitial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value.
float massMass. It describes the inertia of the object in the elastic system, affecting the amplitude of oscillation and the speed of return to equilibrium. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.
float stiffnessStiffness. It is the degree to which an object deforms by resisting the force applied. The greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.
float dampingDamping. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude. Value range: [0, +∞).
If the value is less than or equal to 0, 1 is used.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_CreateCustomCurve()

ArkUI_CurveHandle OH_ArkUI_Curve_CreateCustomCurve(void* userData, float (*interpolate)(float fraction, void* userdata))

Description

Creates a custom curve.

Since: 12

Parameters

NameDescription
void* userDataPointer to user-defined data.
float (*interpolate)(float fraction, void* userdata)User-defined interpolation callback. fraction indicates the input x value for interpolation when the animation starts; value range: [0, 1]. The return value is the y value of the curve. value range: [0, 1]. If fraction is 0, the return value 0 corresponds to the animation start point; any other return value means that the animation jumps at the start point. If fraction is 1, the return value 1 corresponds to the animation end point; any other return value means that the end value of the animation is not the value of the state variable, which will result in an effect of transition from that end value to the value of the state variable.

Return value

TypeDescription
ArkUI_CurveHandlePointer to the interpolation object of the curve. Returns NULL if a parameter error occurs.

OH_ArkUI_Curve_DisposeCurve()

void OH_ArkUI_Curve_DisposeCurve(ArkUI_CurveHandle curveHandle)

Description

Disposes of a custom curve.

Since: 12

Parameters

NameDescription
ArkUI_CurveHandle curveHandlePointer to the interpolation object of the curve.

OH_ArkUI_CreateOpacityTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateOpacityTransitionEffect(float opacity)

Description

Creates an opacity effect object for component transitions.

Since: 12

Parameters

NameDescription
float opacityOpacity. Value range: [0, 1]. The default value is 1. A value less than 0 is treated as 0. A value greater than 1 is treated as 1. The value 1 means fully opaque, and 0 means fully transparent.

Return value

TypeDescription
ArkUI_TransitionEffect*Opacity effect object for component transitions.

OH_ArkUI_CreateTranslationTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateTranslationTransitionEffect(ArkUI_TranslationOptions* translate)

Description

Creates a translation effect object for component transitions.

Since: 12

Parameters

NameDescription
ArkUI_TranslationOptions* translateTranslation parameter object for component transitions.

Return value

TypeDescription
ArkUI_TransitionEffect*Translation effect object for component transitions. Returns NULL if a parameter error occurs.

OH_ArkUI_CreateScaleTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateScaleTransitionEffect(ArkUI_ScaleOptions* scale)

Description

Creates a scaling effect object for component transitions.

Since: 12

Parameters

NameDescription
ArkUI_ScaleOptions* scaleScaling parameter object for component transitions.

Return value

TypeDescription
ArkUI_TransitionEffect*Scaling effect object for component transitions. Returns NULL if a parameter error occurs.

OH_ArkUI_CreateRotationTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateRotationTransitionEffect(ArkUI_RotationOptions* rotate)

Description

Creates a rotation effect object for component transition.

Since: 12

Parameters

NameDescription
ArkUI_RotationOptions* rotateRotation parameter object for component transitions.

Return value

TypeDescription
ArkUI_TransitionEffect*Rotation effect object for component transitions. Returns NULL if a parameter error occurs.

OH_ArkUI_CreateMovementTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateMovementTransitionEffect(ArkUI_TransitionEdge edge)

Description

Creates a movement transition effect object for the component.

Since: 12

Parameters

NameDescription
ArkUI_TransitionEdge edgeMovement transition type.

Return value

TypeDescription
ArkUI_TransitionEffect*Translation effect object for component transitions. Returns NULL if a parameter error occurs.

OH_ArkUI_CreateAsymmetricTransitionEffect()

ArkUI_TransitionEffect* OH_ArkUI_CreateAsymmetricTransitionEffect(ArkUI_TransitionEffect* appear, ArkUI_TransitionEffect* disappear)

Description

Creates an asymmetric transition effect.

NOTE

If this function is not used for ArkUI_TransitionEffect, the transition effect takes effect for both appearance and disappearance of the component.

Since: 12

Parameters

NameDescription
ArkUI_TransitionEffect* appearTransition effect for appearance.
ArkUI_TransitionEffect* disappearTransition effect for disappearance.

Return value

TypeDescription
ArkUI_TransitionEffect*Asymmetric transition effect. Returns NULL if a parameter error occurs.

OH_ArkUI_TransitionEffect_Dispose()

void OH_ArkUI_TransitionEffect_Dispose(ArkUI_TransitionEffect* effect)

Description

Disposes of a transition effect.

Since: 12

Parameters

NameDescription
ArkUI_TransitionEffect* effectPointer to the transition effect to be disposed.

OH_ArkUI_TransitionEffect_Combine()

int32_t OH_ArkUI_TransitionEffect_Combine(ArkUI_TransitionEffect* firstEffect, ArkUI_TransitionEffect* secondEffect)

Description

Sets a combination of transition effects.

Since: 12

Parameters

NameDescription
ArkUI_TransitionEffect* firstEffectTransition effect.
ArkUI_TransitionEffect* secondEffectCombination of transition effects.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

OH_ArkUI_TransitionEffect_SetAnimation()

int32_t OH_ArkUI_TransitionEffect_SetAnimation(ArkUI_TransitionEffect* effect, ArkUI_AnimateOption* animation)

Description

Sets transition effect animation settings.

NOTE

If OH_ArkUI_TransitionEffect_Combine is used to combine transition effects, the animation parameter settings of a transition effect are applicable to the one following it.

Since: 12

Parameters

NameDescription
ArkUI_TransitionEffect* effectTransition effect.
ArkUI_AnimateOption* animationAnimation settings.

Return value

TypeDescription
int32_tResult code.
Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful.
Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-uicontext-contextmenucontroller

openharmony 鸿蒙 errorcode-canvas

openharmony 鸿蒙 capi-oh-nativexcomponent-native-xcomponent-oh-nativexcomponent

openharmony 鸿蒙 errorcode-bindSheet

openharmony 鸿蒙 js-apis-arkui-uiExtension-sys

openharmony 鸿蒙 capi-arkui-accessibility-arkui-accessibilityeventinfo

openharmony 鸿蒙 capi-arkui-rendernodeutils

openharmony 鸿蒙 js-apis-arkui-node

openharmony 鸿蒙 capi-native-node-h

openharmony 鸿蒙 capi-arkui-nativemodule-arkui-listitemswipeactionitem

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/vuIs7XAO