@react-native-ohos/lottie-react-native 6.4.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.en.md +36 -0
  3. package/README.md +13 -0
  4. package/harmony/lottie/BuildProfile.ets +17 -0
  5. package/harmony/lottie/LICENSE +15 -0
  6. package/harmony/lottie/NOTICE +244 -0
  7. package/harmony/lottie/OAT.xml +54 -0
  8. package/harmony/lottie/README.OpenSource +20 -0
  9. package/harmony/lottie/build-profile.json5 +8 -0
  10. package/harmony/lottie/hvigorfile.ts +1 -0
  11. package/harmony/lottie/index.ets +8 -0
  12. package/harmony/lottie/oh-package.json5 +14 -0
  13. package/harmony/lottie/src/main/cpp/CMakeLists.txt +9 -0
  14. package/harmony/lottie/src/main/cpp/LottieAnimationViewPackage.h +15 -0
  15. package/harmony/lottie/src/main/cpp/generated/RNOH/generated/BaseLottieReactNativePackage.h +78 -0
  16. package/harmony/lottie/src/main/cpp/generated/RNOH/generated/components/LottieAnimationViewJSIBinder.h +46 -0
  17. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ComponentDescriptors.h +22 -0
  18. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.cpp +46 -0
  19. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.h +39 -0
  20. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.cpp +43 -0
  21. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.h +43 -0
  22. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.cpp +19 -0
  23. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.h +33 -0
  24. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.cpp +16 -0
  25. package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.h +20 -0
  26. package/harmony/lottie/src/main/ets/LottieAnimationTools.ets +21 -0
  27. package/harmony/lottie/src/main/ets/LottieAnimationView.ets +393 -0
  28. package/harmony/lottie/src/main/ets/LottieAnimationViewPackage.ets +26 -0
  29. package/harmony/lottie/src/main/ets/LottieCompositionCache.ets +30 -0
  30. package/harmony/lottie/src/main/ets/common/Animation.ts +43 -0
  31. package/harmony/lottie/src/main/ets/common/AnimationType.ets +50 -0
  32. package/harmony/lottie/src/main/ets/common/TextUtils.ets +18 -0
  33. package/harmony/lottie/src/main/ets/generated/components/LottieAnimationView.ts +181 -0
  34. package/harmony/lottie/src/main/ets/generated/components/ts.ts +5 -0
  35. package/harmony/lottie/src/main/ets/generated/index.ets +5 -0
  36. package/harmony/lottie/src/main/ets/generated/ts.ts +6 -0
  37. package/harmony/lottie/src/main/ets/generated/turboModules/ts.ts +5 -0
  38. package/harmony/lottie/src/main/module.json5 +9 -0
  39. package/harmony/lottie/src/main/resources/base/element/string.json +8 -0
  40. package/harmony/lottie/src/main/resources/en_US/element/string.json +8 -0
  41. package/harmony/lottie/src/main/resources/zh_CN/element/string.json +8 -0
  42. package/harmony/lottie/ts.ets +5 -0
  43. package/harmony/lottie.har +0 -0
  44. package/lib/commonjs/LottieAnimationViewNativeComponent.js +18 -0
  45. package/lib/commonjs/LottieAnimationViewNativeComponent.js.map +1 -0
  46. package/lib/commonjs/codegenUtils.js +2 -0
  47. package/lib/commonjs/codegenUtils.js.map +1 -0
  48. package/lib/commonjs/index.js +22 -0
  49. package/lib/commonjs/index.js.map +1 -0
  50. package/lib/module/LottieAnimationViewNativeComponent.js +11 -0
  51. package/lib/module/LottieAnimationViewNativeComponent.js.map +1 -0
  52. package/lib/module/codegenUtils.js +2 -0
  53. package/lib/module/codegenUtils.js.map +1 -0
  54. package/lib/module/index.js +4 -0
  55. package/lib/module/index.js.map +1 -0
  56. package/lib/typescript/LottieAnimationViewNativeComponent.d.ts +44 -0
  57. package/lib/typescript/LottieAnimationViewNativeComponent.d.ts.map +1 -0
  58. package/lib/typescript/codegenUtils.d.ts +3 -0
  59. package/lib/typescript/codegenUtils.d.ts.map +1 -0
  60. package/lib/typescript/index.d.ts +4 -0
  61. package/lib/typescript/index.d.ts.map +1 -0
  62. package/package.json +138 -0
  63. package/src/LottieAnimationViewNativeComponent.ts +78 -0
  64. package/src/codegenUtils.ts +9 -0
  65. package/src/index.tsx +3 -0
@@ -0,0 +1,9 @@
1
+ cmake_minimum_required(VERSION 3.13)
2
+ set(CMAKE_VERBOSE_MAKEFILE on)
3
+
4
+ set(rnoh_lottie_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
5
+ file(GLOB_RECURSE rnoh_lottie_generated_SRC "${rnoh_lottie_generated_dir}/**/*.cpp")
6
+ file(GLOB rnoh_lottie_SRC CONFIGURE_DEPENDS *.cpp)
7
+ add_library(rnoh_lottie SHARED ${rnoh_lottie_SRC} ${rnoh_lottie_generated_SRC})
8
+ target_include_directories(rnoh_lottie PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_lottie_generated_dir})
9
+ target_link_libraries(rnoh_lottie PUBLIC rnoh)
@@ -0,0 +1,15 @@
1
+ // Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a Apache-2.0 license that can be
3
+ // found in the LICENSE file.
4
+ #ifndef LOTTIEANIMATIONVIEWPACKAGE_H
5
+ #define LOTTIEANIMATIONVIEWPACKAGE_H
6
+ #pragma once
7
+
8
+ #include "generated/RNOH/generated/BaseLottieReactNativePackage.h"
9
+ namespace rnoh {
10
+ class LottieAnimationViewPackage : public BaseLottieReactNativePackage {
11
+ using Super = BaseLottieReactNativePackage;
12
+ using Super::Super;
13
+ };
14
+ } // namespace rnoh
15
+ #endif // LOTTIEANIMATIONVIEWPACKAGE_H
@@ -0,0 +1,78 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+ #ifndef BASELOTTIEREACTNATIVEPACKAGE_H
5
+ #define BASELOTTIEREACTNATIVEPACKAGE_H
6
+ #pragma once
7
+
8
+ #include <react/renderer/components/lottie_react_native/ComponentDescriptors.h>
9
+ #include "RNOH/Package.h"
10
+ #include "RNOH/ArkTSTurboModule.h"
11
+ #include "RNOH/generated/components/LottieAnimationViewJSIBinder.h"
12
+
13
+ namespace rnoh {
14
+
15
+ class BaseLottieReactNativePackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
16
+ public:
17
+ SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override
18
+ {
19
+ return nullptr;
20
+ };
21
+ };
22
+
23
+ class BaseLottieReactNativePackageEventEmitRequestHandler : public EventEmitRequestHandler {
24
+ public:
25
+ void handleEvent(Context const &ctx) override
26
+ {
27
+ auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
28
+ if (eventEmitter == nullptr) {
29
+ return;
30
+ }
31
+
32
+ std::vector<std::string> supportedEventNames = {
33
+ "animationFinish",
34
+ "animationFailure",
35
+ "animationLoaded",
36
+ };
37
+ if (std::find(supportedEventNames.begin(), supportedEventNames.end(),
38
+ ctx.eventName) != supportedEventNames.end()) {
39
+ eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
40
+ }
41
+ }
42
+ };
43
+
44
+
45
+ class BaseLottieReactNativePackage : public Package {
46
+ public:
47
+ BaseLottieReactNativePackage(Package::Context ctx) : Package(ctx){};
48
+
49
+ std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override
50
+ {
51
+ return std::make_unique<BaseLottieReactNativePackageTurboModuleFactoryDelegate>();
52
+ }
53
+
54
+ std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override
55
+ {
56
+ return {
57
+ facebook::react::concreteComponentDescriptorProvider<
58
+ facebook::react::LottieAnimationViewComponentDescriptor>(),
59
+ };
60
+ }
61
+
62
+ ComponentJSIBinderByString createComponentJSIBinderByName() override
63
+ {
64
+ return {
65
+ {"LottieAnimationView", std::make_shared<LottieAnimationViewJSIBinder>()},
66
+ };
67
+ };
68
+
69
+ EventEmitRequestHandlers createEventEmitRequestHandlers() override
70
+ {
71
+ return {
72
+ std::make_shared<BaseLottieReactNativePackageEventEmitRequestHandler>(),
73
+ };
74
+ }
75
+ };
76
+
77
+ } // namespace rnoh
78
+ #endif // BASELOTTIEREACTNATIVEPACKAGE_H
@@ -0,0 +1,46 @@
1
+ /**
2
+ * This code was generated by "react-native codegen-lib-harmony"
3
+ */
4
+
5
+ #pragma once
6
+ #include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
7
+
8
+ namespace rnoh {
9
+ class LottieAnimationViewJSIBinder : public ViewComponentJSIBinder {
10
+ protected:
11
+ facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override
12
+ {
13
+ auto object = ViewComponentJSIBinder::createNativeProps(rt);
14
+ object.setProperty(rt, "resizeMode", true);
15
+ object.setProperty(rt, "renderMode", true);
16
+ object.setProperty(rt, "sourceName", true);
17
+ object.setProperty(rt, "sourceJson", true);
18
+ object.setProperty(rt, "sourceURL", true);
19
+ object.setProperty(rt, "imageAssetsFolder", true);
20
+ object.setProperty(rt, "progress", true);
21
+ object.setProperty(rt, "speed", true);
22
+ object.setProperty(rt, "loop", true);
23
+ object.setProperty(rt, "autoPlay", true);
24
+ object.setProperty(rt, "enableMergePathsAndroidForKitKatAndAbove", true);
25
+ object.setProperty(rt, "hardwareAccelerationAndroid", true);
26
+ object.setProperty(rt, "cacheComposition", true);
27
+ object.setProperty(rt, "colorFilters", true);
28
+ return object;
29
+ }
30
+
31
+ facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override
32
+ {
33
+ facebook::jsi::Object events(rt);
34
+ return events;
35
+ }
36
+
37
+ facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override
38
+ {
39
+ facebook::jsi::Object events(rt);
40
+ events.setProperty(rt, "topAnimationFinish", createDirectEvent(rt, "onAnimationFinish"));
41
+ events.setProperty(rt, "topAnimationFailure", createDirectEvent(rt, "onAnimationFailure"));
42
+ events.setProperty(rt, "topAnimationLoaded", createDirectEvent(rt, "onAnimationLoaded"));
43
+ return events;
44
+ }
45
+ };
46
+ } // namespace rnoh
@@ -0,0 +1,22 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateComponentDescriptorH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/lottie_react_native/ShadowNodes.h>
14
+ #include <react/renderer/core/ConcreteComponentDescriptor.h>
15
+
16
+ namespace facebook {
17
+ namespace react {
18
+
19
+ using LottieAnimationViewComponentDescriptor = ConcreteComponentDescriptor<LottieAnimationViewShadowNode>;
20
+
21
+ } // namespace react
22
+ } // namespace facebook
@@ -0,0 +1,46 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/lottie_react_native/EventEmitters.h>
12
+
13
+
14
+ namespace facebook {
15
+ namespace react {
16
+
17
+ void LottieAnimationViewEventEmitter::onAnimationFinish(OnAnimationFinish $event) const
18
+ {
19
+ dispatchEvent("animationFinish", [$event = std::move($event)](jsi::Runtime &runtime) {
20
+ auto $payload = jsi::Object(runtime);
21
+ $payload.setProperty(runtime, "isCancelled", $event.isCancelled);
22
+ return $payload;
23
+ });
24
+ }
25
+
26
+
27
+ void LottieAnimationViewEventEmitter::onAnimationFailure(OnAnimationFailure $event) const
28
+ {
29
+ dispatchEvent("animationFailure", [$event = std::move($event)](jsi::Runtime &runtime) {
30
+ auto $payload = jsi::Object(runtime);
31
+ $payload.setProperty(runtime, "error", $event.error);
32
+ return $payload;
33
+ });
34
+ }
35
+
36
+
37
+ void LottieAnimationViewEventEmitter::onAnimationLoaded(OnAnimationLoaded $event) const
38
+ {
39
+ dispatchEvent("animationLoaded", [](jsi::Runtime &runtime) {
40
+ auto $payload = jsi::Object(runtime);
41
+ return $payload;
42
+ });
43
+ }
44
+
45
+ } // namespace react
46
+ } // namespace facebook
@@ -0,0 +1,39 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateEventEmitterH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewEventEmitter.h>
13
+
14
+
15
+ namespace facebook {
16
+ namespace react {
17
+ class LottieAnimationViewEventEmitter : public ViewEventEmitter {
18
+ public:
19
+ using ViewEventEmitter::ViewEventEmitter;
20
+
21
+ struct OnAnimationFinish {
22
+ bool isCancelled;
23
+ };
24
+
25
+ struct OnAnimationFailure {
26
+ std::string error;
27
+ };
28
+
29
+ struct OnAnimationLoaded {
30
+ };
31
+
32
+ void onAnimationFinish(OnAnimationFinish value) const;
33
+
34
+ void onAnimationFailure(OnAnimationFailure value) const;
35
+
36
+ void onAnimationLoaded(OnAnimationLoaded value) const;
37
+ };
38
+ } // namespace react
39
+ } // namespace facebook
@@ -0,0 +1,43 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/lottie_react_native/Props.h>
12
+ #include <folly/dynamic.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+ #include <react/renderer/core/propsConversions.h>
15
+
16
+ namespace facebook {
17
+ namespace react {
18
+
19
+ LottieAnimationViewProps::LottieAnimationViewProps(
20
+ const PropsParserContext &context,
21
+ const LottieAnimationViewProps &sourceProps,
22
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
23
+
24
+ resizeMode(convertRawProp(context, rawProps, "resizeMode", sourceProps.resizeMode, {})),
25
+ renderMode(convertRawProp(context, rawProps, "renderMode", sourceProps.renderMode, {})),
26
+ sourceName(convertRawProp(context, rawProps, "sourceName", sourceProps.sourceName, {})),
27
+ sourceJson(convertRawProp(context, rawProps, "sourceJson", sourceProps.sourceJson, {})),
28
+ sourceURL(convertRawProp(context, rawProps, "sourceURL", sourceProps.sourceURL, {})),
29
+ imageAssetsFolder(convertRawProp(context, rawProps, "imageAssetsFolder", sourceProps.imageAssetsFolder, {})),
30
+ progress(convertRawProp(context, rawProps, "progress", sourceProps.progress, {0.0})),
31
+ speed(convertRawProp(context, rawProps, "speed", sourceProps.speed, {0.0})),
32
+ loop(convertRawProp(context, rawProps, "loop", sourceProps.loop, {false})),
33
+ autoPlay(convertRawProp(context, rawProps, "autoPlay", sourceProps.autoPlay, {false})),
34
+ enableMergePathsAndroidForKitKatAndAbove(convertRawProp(context, rawProps,
35
+ "enableMergePathsAndroidForKitKatAndAbove", sourceProps.enableMergePathsAndroidForKitKatAndAbove, {false})),
36
+ hardwareAccelerationAndroid(convertRawProp(context, rawProps, "hardwareAccelerationAndroid",
37
+ sourceProps.hardwareAccelerationAndroid, {false})),
38
+ cacheComposition(convertRawProp(context, rawProps, "cacheComposition", sourceProps.cacheComposition, {false})),
39
+ colorFilters(convertRawProp(context, rawProps, "colorFilters", sourceProps.colorFilters, {}))
40
+ {}
41
+
42
+ } // namespace react
43
+ } // namespace facebook
@@ -0,0 +1,43 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GeneratePropsH.js
9
+ */
10
+ #pragma once
11
+
12
+ #include <react/renderer/components/view/ViewProps.h>
13
+ #include <react/renderer/core/PropsParserContext.h>
14
+
15
+ namespace facebook {
16
+ namespace react {
17
+
18
+ class LottieAnimationViewProps final : public ViewProps {
19
+ public:
20
+ LottieAnimationViewProps() = default;
21
+ LottieAnimationViewProps(const PropsParserContext& context,
22
+ const LottieAnimationViewProps &sourceProps, const RawProps &rawProps);
23
+
24
+ #pragma mark - Props
25
+
26
+ std::string resizeMode{};
27
+ std::string renderMode{};
28
+ std::string sourceName{};
29
+ std::string sourceJson{};
30
+ std::string sourceURL{};
31
+ std::string imageAssetsFolder{};
32
+ Float progress{0.0};
33
+ double speed{0.0};
34
+ bool loop{false};
35
+ bool autoPlay{false};
36
+ bool enableMergePathsAndroidForKitKatAndAbove{false};
37
+ bool hardwareAccelerationAndroid{false};
38
+ bool cacheComposition{false};
39
+ folly::dynamic colorFilters{};
40
+ };
41
+
42
+ } // namespace react
43
+ } // namespace facebook
@@ -0,0 +1,19 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeCpp.js
9
+ */
10
+
11
+ #include <react/renderer/components/lottie_react_native/ShadowNodes.h>
12
+
13
+ namespace facebook {
14
+ namespace react {
15
+
16
+ const char LOTTIE_ANIMATION_VIEW_COMPONENT_NAME[] = "LottieAnimationView";
17
+
18
+ } // namespace react
19
+ } // namespace facebook
@@ -0,0 +1,33 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateShadowNodeH.js
9
+ */
10
+
11
+ #pragma once
12
+
13
+ #include <react/renderer/components/lottie_react_native/EventEmitters.h>
14
+ #include <react/renderer/components/lottie_react_native/Props.h>
15
+ #include <react/renderer/components/lottie_react_native/States.h>
16
+ #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
+ #include <jsi/jsi.h>
18
+
19
+ namespace facebook {
20
+ namespace react {
21
+
22
+ JSI_EXPORT extern const char LOTTIE_ANIMATION_VIEW_COMPONENT_NAME[32];
23
+
24
+ /*
25
+ * `ShadowNode` for <LottieAnimationView> component.
26
+ */
27
+ using LottieAnimationViewShadowNode = ConcreteViewShadowNode<
28
+ LOTTIE_ANIMATION_VIEW_COMPONENT_NAME,
29
+ LottieAnimationViewProps,
30
+ LottieAnimationViewEventEmitter,
31
+ LottieAnimationViewState>;
32
+ } // namespace react
33
+ } // namespace facebook
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
+ *
5
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
6
+ * once the code is regenerated.
7
+ *
8
+ * @generated by codegen project: GenerateStateCpp.js
9
+ */
10
+ #include <react/renderer/components/lottie_react_native/States.h>
11
+
12
+ namespace facebook {
13
+ namespace react {
14
+
15
+ } // namespace react
16
+ } // namespace facebook
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
3
+ *
4
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
5
+ * once the code is regenerated.
6
+ *
7
+ * @generated by codegen project: GenerateStateH.js
8
+ */
9
+ #pragma once
10
+
11
+ namespace facebook {
12
+ namespace react {
13
+
14
+ class LottieAnimationViewState {
15
+ public:
16
+ LottieAnimationViewState() = default;
17
+ };
18
+
19
+ } // namespace react
20
+ } // namespace facebook
@@ -0,0 +1,21 @@
1
+ // Copyright (c) 2024 Huawei Device Co., Ltd. All rights reserved
2
+ // Use of this source code is governed by a Apache-2.0 license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import { AnimationObject, AnimationAssets } from './common/Animation'
6
+ import { isEmpty } from './common/TextUtils'
7
+
8
+ export function convertImageFolder(jsonData: AnimationObject, imagesFolder: string): AnimationObject {
9
+ let assets: AnimationAssets[] = jsonData.assets
10
+ if (assets != undefined && assets.length > 0 && !isEmpty(imagesFolder)) {
11
+ if (imagesFolder.charAt(imagesFolder.length - 1) != '/') {
12
+ imagesFolder = imagesFolder + '/'
13
+ }
14
+ let assetsTemp: AnimationAssets[] = assets.map((obj: AnimationAssets) => {
15
+ obj.u = imagesFolder
16
+ return obj
17
+ })
18
+ jsonData.assets = assetsTemp
19
+ }
20
+ return jsonData
21
+ }