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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NODE_ANIMATE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NODE_ANIMATE_H
18 
19 #include "core/interfaces/arkoala/arkoala_api.h"
20 #include "core/interfaces/native/node/node_utils.h"
21 
22 namespace OHOS::Ace::NG::ViewAnimate {
23 
24 void AnimateToInner(AnimationOption& option, const std::function<void()>& animateToFunc,
25     const std::function<void()>& onFinishFunc, bool immediately);
26 
27 void AnimateTo(ArkUIContext* context, ArkUIAnimateOption option, void (*event)(void* userData), void* user);
28 
29 void KeyframeAnimateTo(ArkUIContext* context, ArkUIKeyframeAnimateOption* animateOption);
30 ArkUIAnimatorHandle CreateAnimator(ArkUIContext* context, ArkUIAnimatorOption* option);
31 void DisposeAnimator(ArkUIAnimatorHandle animatorHandle);
32 
33 int32_t AnimatorReset(ArkUIAnimatorHandle animatorHandle, ArkUIAnimatorOption* option);
34 int32_t AnimatorPlay(ArkUIAnimatorHandle animatorHandle);
35 int32_t AnimatorFinish(ArkUIAnimatorHandle animatorHandle);
36 int32_t AnimatorPause(ArkUIAnimatorHandle animatorHandle);
37 int32_t AnimatorCancel(ArkUIAnimatorHandle animatorHandle);
38 int32_t AnimatorReverse(ArkUIAnimatorHandle animatorHandle);
39 
40 ArkUICurveHandle CreateCurve(ArkUI_Int32 curve);
41 ArkUICurveHandle CreateStepsCurve(ArkUI_Int32 count, ArkUI_Bool end);
42 ArkUICurveHandle CreateCubicBezierCurve(ArkUI_Float32 x1, ArkUI_Float32 y1, ArkUI_Float32 x2, ArkUI_Float32 y2);
43 ArkUICurveHandle CreateSpringCurve(
44     ArkUI_Float32 velocity, ArkUI_Float32 mass, ArkUI_Float32 stiffness, ArkUI_Float32 damping);
45 ArkUICurveHandle CreateSpringMotion(
46     ArkUI_Float32 response, ArkUI_Float32 dampingFraction, ArkUI_Float32 overlapDuration);
47 ArkUICurveHandle CreateResponsiveSpringMotion(
48     ArkUI_Float32 response, ArkUI_Float32 dampingFraction, ArkUI_Float32 overlapDuration);
49 ArkUICurveHandle CreateInterpolatingSpring(
50     ArkUI_Float32 velocity, ArkUI_Float32 mass, ArkUI_Float32 stiffness, ArkUI_Float32 damping);
51 ArkUICurveHandle CreateCustomCurve(
52     ArkUI_Float32 (*interpolate)(ArkUI_Float32 fraction, void* userData), void* userData);
53 void DisposeCurve(ArkUICurveHandle curve);
54 } // namespace OHOS::Ace::NG::ViewAnimate
55 
56 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NODE_ANIMATE_H
57