1 /*
2 * Copyright (c) 2021-2023 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 #include "frameworks/bridge/declarative_frontend/engine/jsi/modules/jsi_curves_module.h"
17
18 #include "base/json/json_util.h"
19 #include "frameworks/bridge/common/utils/utils.h"
20 #include "frameworks/bridge/declarative_frontend/engine/jsi/jsi_declarative_engine.h"
21 #include "frameworks/bridge/js_frontend/engine/common/js_constants.h"
22 #include "frameworks/core/animation/curve.h"
23 #include "frameworks/core/common/container.h"
24
25 namespace OHOS::Ace::Framework {
26
CurvesInterpolate(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)27 shared_ptr<JsValue> CurvesInterpolate(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
28 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
29 {
30 auto jsCurveString = thisObj->GetProperty(runtime, "__curveString");
31 auto curveString = jsCurveString->ToString(runtime);
32 auto curveObjFunc = thisObj->GetProperty(runtime, "__curveCustomFunc");
33 if (argv.size() == 0) {
34 return runtime->NewNull();
35 }
36 double time = 0.0;
37 if (argv[0]->IsNumber(runtime)) {
38 time = argv[0]->ToDouble(runtime);
39 }
40 time = std::clamp(time, 0.0, 1.0);
41 auto animationCurve = CreateCurve(curveString, false);
42 if (curveObjFunc->IsFunction(runtime)) {
43 std::function<float(float)> customCallBack = [func = std::move(curveObjFunc), id = Container::CurrentId(),
44 runtime](float time) -> float {
45 ContainerScope scope(id);
46 std::vector<shared_ptr<JsValue>> argv = { runtime->NewNumber(time) };
47 auto result = func->Call(runtime, runtime->GetGlobal(), argv, 1);
48 return result->IsNumber(runtime) ? static_cast<float>(result->ToDouble(runtime)) : 1.0f;
49 };
50 animationCurve = CreateCurve(customCallBack);
51 }
52 if (!animationCurve) {
53 return runtime->NewNull();
54 }
55 double curveValue = animationCurve->Move(time);
56 return runtime->NewNumber(curveValue);
57 }
58
CurvesInitInternal(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)59 shared_ptr<JsValue> CurvesInitInternal(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
60 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
61 {
62 auto curveObj = runtime->NewObject();
63 curveObj->SetProperty(runtime, CURVE_INTERPOLATE, runtime->NewFunction(CurvesInterpolate));
64 if (argc != 1 && argc != 0) {
65 return runtime->NewNull();
66 }
67 RefPtr<Curve> curve;
68 std::string curveString;
69 if (argc == 1) {
70 curveString = argv[0]->ToString(runtime);
71 } else {
72 curveString = "linear";
73 }
74 curve = CreateCurve(curveString);
75 curveObj->SetProperty(runtime, "__curveString", runtime->NewString(curveString));
76 if (Container::IsCurrentUseNewPipeline()) {
77 return curveObj;
78 }
79
80 auto page = JsiDeclarativeEngineInstance::GetStagingPage(Container::CurrentId());
81 int32_t pageId = -1;
82 if (page) {
83 pageId = page->GetPageId();
84 }
85 curveObj->SetProperty(runtime, "__pageId", runtime->NewInt32(pageId));
86 return curveObj;
87 }
88
CurvesInit(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)89 shared_ptr<JsValue> CurvesInit(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
90 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
91 {
92 return CurvesInitInternal(runtime, thisObj, argv, argc);
93 }
94
InitCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)95 shared_ptr<JsValue> InitCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
96 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
97 {
98 return CurvesInitInternal(runtime, thisObj, argv, argc);
99 }
100
CreateSpringCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)101 bool CreateSpringCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
102 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
103 {
104 if (argc != 4) {
105 return false;
106 }
107 double velocity = 0.0;
108 double mass = 1.0;
109 double stiffness = 1.0;
110 double damping = 1.0;
111 if (argv[0]->IsNumber(runtime)) {
112 velocity = argv[0]->ToDouble(runtime);
113 }
114 if (argv[1]->IsNumber(runtime)) {
115 mass = argv[1]->ToDouble(runtime);
116 if (LessOrEqual(mass, 0.0)) {
117 mass = 1.0;
118 }
119 }
120 if (argv[2]->IsNumber(runtime)) {
121 stiffness = argv[2]->ToDouble(runtime);
122 if (LessOrEqual(stiffness, 0.0)) {
123 stiffness = 1.0;
124 }
125 }
126 if (argv[3]->IsNumber(runtime)) {
127 damping = argv[3]->ToDouble(runtime);
128 if (LessOrEqual(damping, 0.0)) {
129 damping = 1.0;
130 }
131 }
132 curve = AceType::MakeRefPtr<SpringCurve>(velocity, mass, stiffness, damping);
133 return true;
134 }
135
CreateInterpolatingSpring(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)136 bool CreateInterpolatingSpring(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
137 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
138 {
139 if (argc != 4) {
140 return false;
141 }
142 float velocity = static_cast<float>(argv[0]->IsNumber(runtime) ? argv[0]->ToDouble(runtime) : 0.0);
143 float mass = static_cast<float>(argv[1]->IsNumber(runtime) ? argv[1]->ToDouble(runtime) : 1.0);
144 float stiffness = static_cast<float>(argv[2]->IsNumber(runtime) ? argv[2]->ToDouble(runtime) : 1.0);
145 float damping = static_cast<float>(argv[3]->IsNumber(runtime) ? argv[3]->ToDouble(runtime) : 1.0);
146 if (LessOrEqual(mass, 0)) {
147 mass = 1.0;
148 }
149 if (LessOrEqual(stiffness, 0)) {
150 stiffness = 1.0;
151 }
152 if (LessOrEqual(damping, 0)) {
153 damping = 1.0;
154 }
155 curve = AceType::MakeRefPtr<InterpolatingSpring>(velocity, mass, stiffness, damping);
156 return true;
157 }
158
CreateCubicCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)159 bool CreateCubicCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
160 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
161 {
162 if (argc != 4) {
163 return false;
164 }
165 double x0 = 0.0;
166 double y0 = 0.0;
167 double x1 = 0.0;
168 double y1 = 0.0;
169 if (argv[0]->IsNumber(runtime)) {
170 x0 = argv[0]->ToDouble(runtime);
171 }
172 if (argv[1]->IsNumber(runtime)) {
173 y0 = argv[1]->ToDouble(runtime);
174 }
175 if (argv[2]->IsNumber(runtime)) {
176 x1 = argv[2]->ToDouble(runtime);
177 }
178 if (argv[3]->IsNumber(runtime)) {
179 y1 = argv[3]->ToDouble(runtime);
180 }
181 x0 = std::clamp(x0, 0.0, 1.0);
182 x1 = std::clamp(x1, 0.0, 1.0);
183
184 curve = AceType::MakeRefPtr<CubicCurve>(x0, y0, x1, y1);
185 return true;
186 }
187
CreateStepsCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)188 bool CreateStepsCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
189 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
190 {
191 if (argc != 1 && argc != 2) {
192 return false;
193 }
194 int32_t stepSize = 1;
195 if (argv[0]->IsNumber(runtime)) {
196 stepSize = argv[0]->ToInt32(runtime);
197 if (stepSize < 1) {
198 stepSize = 1;
199 }
200 }
201 if (argc == 2) {
202 bool isEnd = argv[1]->ToBoolean(runtime);
203 if (isEnd) {
204 curve = AceType::MakeRefPtr<StepsCurve>(stepSize, StepsCurvePosition::END);
205 } else {
206 curve = AceType::MakeRefPtr<StepsCurve>(stepSize, StepsCurvePosition::START);
207 }
208 } else {
209 curve = AceType::MakeRefPtr<StepsCurve>(stepSize);
210 }
211 return true;
212 }
213
CreateSpringMotionCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)214 bool CreateSpringMotionCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
215 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
216 {
217 if (argc > 3) {
218 return false;
219 }
220 float response = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_RESPONSE;
221 float dampingRatio = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_DAMPING_RATIO;
222 float blendDuration = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_BLEND_DURATION;
223 if (argc > 0 && argv[0]->IsNumber(runtime)) {
224 response = static_cast<float>(argv[0]->ToDouble(runtime));
225 if (LessOrEqual(response, 0)) {
226 response = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_RESPONSE;
227 }
228 }
229 if (argc > 1 && argv[1]->IsNumber(runtime)) {
230 dampingRatio = static_cast<float>(argv[1]->ToDouble(runtime));
231 if (LessNotEqual(dampingRatio, 0)) {
232 dampingRatio = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_DAMPING_RATIO;
233 }
234 }
235 if (argc > 2 && argv[2]->IsNumber(runtime)) {
236 blendDuration = static_cast<float>(argv[2]->ToDouble(runtime));
237 if (LessNotEqual(blendDuration, 0)) {
238 blendDuration = ResponsiveSpringMotion::DEFAULT_SPRING_MOTION_BLEND_DURATION;
239 }
240 }
241 curve = AceType::MakeRefPtr<ResponsiveSpringMotion>(response, dampingRatio, blendDuration);
242 return true;
243 }
244
CreateResponsiveSpringMotionCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,RefPtr<Curve> & curve)245 bool CreateResponsiveSpringMotionCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
246 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, RefPtr<Curve>& curve)
247 {
248 if (argc > 3) {
249 return false;
250 }
251 float response = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_RESPONSE;
252 float dampingRatio = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_DAMPING_RATIO;
253 float blendDuration = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_BLEND_DURATION;
254 if (argc > 0 && argv[0]->IsNumber(runtime)) {
255 response = static_cast<float>(argv[0]->ToDouble(runtime));
256 if (LessOrEqual(response, 0)) {
257 response = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_RESPONSE;
258 }
259 }
260 if (argc > 1 && argv[1]->IsNumber(runtime)) {
261 dampingRatio = static_cast<float>(argv[1]->ToDouble(runtime));
262 if (LessNotEqual(dampingRatio, 0)) {
263 dampingRatio = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_DAMPING_RATIO;
264 }
265 }
266 if (argc > 2 && argv[2]->IsNumber(runtime)) {
267 blendDuration = static_cast<float>(argv[2]->ToDouble(runtime));
268 if (LessNotEqual(blendDuration, 0)) {
269 blendDuration = ResponsiveSpringMotion::DEFAULT_RESPONSIVE_SPRING_MOTION_BLEND_DURATION;
270 }
271 }
272 curve = AceType::MakeRefPtr<ResponsiveSpringMotion>(response, dampingRatio, blendDuration);
273 return true;
274 }
275
ParseCurves(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc,std::string & curveString)276 shared_ptr<JsValue> ParseCurves(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
277 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc, std::string& curveString)
278 {
279 auto curveObj = runtime->NewObject();
280 curveObj->SetProperty(runtime, CURVE_INTERPOLATE, runtime->NewFunction(CurvesInterpolate));
281 RefPtr<Curve> curve;
282 bool curveCreated;
283 if (curveString == CURVES_SPRING || curveString == SPRING_CURVE) {
284 curveCreated = CreateSpringCurve(runtime, thisObj, argv, argc, curve);
285 } else if (curveString == INTERPOLATING_SPRING) {
286 curveCreated = CreateInterpolatingSpring(runtime, thisObj, argv, argc, curve);
287 } else if (curveString == CURVES_CUBIC_BEZIER || curveString == CUBIC_BEZIER_CURVE) {
288 curveCreated = CreateCubicCurve(runtime, thisObj, argv, argc, curve);
289 } else if (curveString == CURVES_STEPS || curveString == STEPS_CURVE) {
290 curveCreated = CreateStepsCurve(runtime, thisObj, argv, argc, curve);
291 } else if (curveString == SPRING_MOTION) {
292 curveCreated = CreateSpringMotionCurve(runtime, thisObj, argv, argc, curve);
293 } else if (curveString == RESPONSIVE_SPRING_MOTION) {
294 curveCreated = CreateResponsiveSpringMotionCurve(runtime, thisObj, argv, argc, curve);
295 } else if (curveString == CURVES_CUSTOM) {
296 curve = AceType::MakeRefPtr<CustomCurve>(nullptr);
297 curveCreated = true;
298 if (argv[0]->IsFunction(runtime)) {
299 curveObj->SetProperty(runtime, "__curveCustomFunc", argv[0]);
300 } else {
301 curveCreated = false;
302 }
303 } else {
304 return runtime->NewNull();
305 }
306 if (!curveCreated) {
307 return runtime->NewNull();
308 }
309 auto customCurve = curve->ToString();
310 curveObj->SetProperty(runtime, "__curveString", runtime->NewString(customCurve));
311 if (Container::IsCurrentUseNewPipeline()) {
312 return curveObj;
313 }
314 auto page = JsiDeclarativeEngineInstance::GetStagingPage(Container::CurrentId());
315 int32_t pageId = -1;
316 if (page) {
317 pageId = page->GetPageId();
318 }
319 curveObj->SetProperty(runtime, "__pageId", runtime->NewInt32(pageId));
320 return curveObj;
321 }
322
CurvesBezier(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)323 shared_ptr<JsValue> CurvesBezier(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
324 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
325 {
326 std::string curveString(CURVES_CUBIC_BEZIER);
327 return ParseCurves(runtime, thisObj, argv, argc, curveString);
328 }
329
BezierCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)330 shared_ptr<JsValue> BezierCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
331 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
332 {
333 std::string curveString(CUBIC_BEZIER_CURVE);
334 return ParseCurves(runtime, thisObj, argv, argc, curveString);
335 }
336
CurvesSpring(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)337 shared_ptr<JsValue> CurvesSpring(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
338 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
339 {
340 std::string curveString(CURVES_SPRING);
341 return ParseCurves(runtime, thisObj, argv, argc, curveString);
342 }
343
SpringCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)344 shared_ptr<JsValue> SpringCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
345 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
346 {
347 std::string curveString(SPRING_CURVE);
348 return ParseCurves(runtime, thisObj, argv, argc, curveString);
349 }
350
InterpolatingSpringCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)351 shared_ptr<JsValue> InterpolatingSpringCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
352 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
353 {
354 std::string curveString(INTERPOLATING_SPRING);
355 return ParseCurves(runtime, thisObj, argv, argc, curveString);
356 }
357
CurvesSteps(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)358 shared_ptr<JsValue> CurvesSteps(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
359 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
360 {
361 std::string curveString(CURVES_STEPS);
362 return ParseCurves(runtime, thisObj, argv, argc, curveString);
363 }
364
StepsCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)365 shared_ptr<JsValue> StepsCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
366 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
367 {
368 std::string curveString(STEPS_CURVE);
369 return ParseCurves(runtime, thisObj, argv, argc, curveString);
370 }
CustomCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)371 shared_ptr<JsValue> CustomCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
372 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
373 {
374 std::string curveString(CURVES_CUSTOM);
375 return ParseCurves(runtime, thisObj, argv, argc, curveString);
376 }
377
SpringMotionCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)378 shared_ptr<JsValue> SpringMotionCurve(const shared_ptr<JsRuntime>& runtime, const shared_ptr<JsValue>& thisObj,
379 const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
380 {
381 std::string curveString(SPRING_MOTION);
382 return ParseCurves(runtime, thisObj, argv, argc, curveString);
383 }
384
ResponsiveSpringMotionCurve(const shared_ptr<JsRuntime> & runtime,const shared_ptr<JsValue> & thisObj,const std::vector<shared_ptr<JsValue>> & argv,int32_t argc)385 shared_ptr<JsValue> ResponsiveSpringMotionCurve(const shared_ptr<JsRuntime>& runtime,
386 const shared_ptr<JsValue>& thisObj, const std::vector<shared_ptr<JsValue>>& argv, int32_t argc)
387 {
388 std::string curveString(RESPONSIVE_SPRING_MOTION);
389 return ParseCurves(runtime, thisObj, argv, argc, curveString);
390 }
391
InitCurvesModule(const shared_ptr<JsRuntime> & runtime,shared_ptr<JsValue> & moduleObj)392 void InitCurvesModule(const shared_ptr<JsRuntime>& runtime, shared_ptr<JsValue>& moduleObj)
393 {
394 moduleObj->SetProperty(runtime, CURVES_INIT, runtime->NewFunction(CurvesInit));
395 moduleObj->SetProperty(runtime, INIT_CURVE, runtime->NewFunction(InitCurve));
396 moduleObj->SetProperty(runtime, CURVES_CUBIC_BEZIER, runtime->NewFunction(CurvesBezier));
397 moduleObj->SetProperty(runtime, CUBIC_BEZIER_CURVE, runtime->NewFunction(BezierCurve));
398 moduleObj->SetProperty(runtime, CURVES_SPRING, runtime->NewFunction(CurvesSpring));
399 moduleObj->SetProperty(runtime, SPRING_CURVE, runtime->NewFunction(SpringCurve));
400 moduleObj->SetProperty(runtime, INTERPOLATING_SPRING, runtime->NewFunction(InterpolatingSpringCurve));
401 moduleObj->SetProperty(runtime, CURVES_STEPS, runtime->NewFunction(CurvesSteps));
402 moduleObj->SetProperty(runtime, STEPS_CURVE, runtime->NewFunction(StepsCurve));
403 moduleObj->SetProperty(runtime, SPRING_MOTION, runtime->NewFunction(SpringMotionCurve));
404 moduleObj->SetProperty(runtime, RESPONSIVE_SPRING_MOTION, runtime->NewFunction(ResponsiveSpringMotionCurve));
405 moduleObj->SetProperty(runtime, CURVES_CUSTOM, runtime->NewFunction(CustomCurve));
406 }
407
408 } // namespace OHOS::Ace::Framework