@shopify/react-native-skia 2.0.7 → 2.1.0
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.
- package/android/CMakeLists.txt +20 -1
- package/cpp/api/JsiSkApi.h +3 -0
- package/cpp/api/JsiSkImageFilterFactory.h +478 -39
- package/cpp/api/JsiSkSkottie.h +590 -0
- package/cpp/api/JsiSkottieFactory.h +65 -0
- package/cpp/api/recorder/Command.h +1 -0
- package/cpp/api/recorder/Convertor.h +16 -0
- package/cpp/api/recorder/Drawings.h +23 -0
- package/cpp/api/recorder/JsiRecorder.h +6 -0
- package/cpp/api/recorder/RNRecorder.h +9 -0
- package/cpp/api/third_party/SkottieUtils.cpp +333 -0
- package/cpp/api/third_party/SkottieUtils.h +172 -0
- package/cpp/skia/modules/jsonreader/SkJSONReader.cpp +980 -0
- package/cpp/skia/modules/jsonreader/SkJSONReader.h +389 -0
- package/cpp/skia/modules/skottie/include/ExternalLayer.h +56 -0
- package/cpp/skia/modules/skottie/include/Skottie.h +313 -0
- package/cpp/skia/modules/skottie/include/SkottieProperty.h +190 -0
- package/cpp/skia/modules/skottie/include/SlotManager.h +113 -0
- package/cpp/skia/modules/skottie/include/TextShaper.h +200 -0
- package/cpp/skia/modules/skottie/src/SkottieValue.h +56 -0
- package/cpp/skia/modules/skottie/src/animator/Animator.h +89 -0
- package/cpp/skia/modules/skottie/src/text/Font.h +82 -0
- package/cpp/skia/modules/skottie/src/text/TextAdapter.h +155 -0
- package/cpp/skia/modules/skottie/src/text/TextAnimator.h +121 -0
- package/cpp/skia/modules/skottie/src/text/TextValue.h +28 -0
- package/cpp/skia/modules/sksg/include/SkSGClipEffect.h +61 -0
- package/cpp/skia/modules/sksg/include/SkSGColorFilter.h +135 -0
- package/cpp/skia/modules/sksg/include/SkSGDraw.h +57 -0
- package/cpp/skia/modules/sksg/include/SkSGEffectNode.h +50 -0
- package/cpp/skia/modules/sksg/include/SkSGGeometryEffect.h +181 -0
- package/cpp/skia/modules/sksg/include/SkSGGeometryNode.h +54 -0
- package/cpp/skia/modules/sksg/include/SkSGGradient.h +108 -0
- package/cpp/skia/modules/sksg/include/SkSGGroup.h +65 -0
- package/cpp/skia/modules/sksg/include/SkSGImage.h +59 -0
- package/cpp/skia/modules/sksg/include/SkSGInvalidationController.h +46 -0
- package/cpp/skia/modules/sksg/include/SkSGMaskEffect.h +65 -0
- package/cpp/skia/modules/sksg/include/SkSGMerge.h +74 -0
- package/cpp/skia/modules/sksg/include/SkSGNode.h +128 -0
- package/cpp/skia/modules/sksg/include/SkSGOpacityEffect.h +54 -0
- package/cpp/skia/modules/sksg/include/SkSGPaint.h +112 -0
- package/cpp/skia/modules/sksg/include/SkSGPath.h +68 -0
- package/cpp/skia/modules/sksg/include/SkSGPlane.h +47 -0
- package/cpp/skia/modules/sksg/include/SkSGRect.h +122 -0
- package/cpp/skia/modules/sksg/include/SkSGRenderEffect.h +283 -0
- package/cpp/skia/modules/sksg/include/SkSGRenderNode.h +157 -0
- package/cpp/skia/modules/sksg/include/SkSGScene.h +47 -0
- package/cpp/skia/modules/sksg/include/SkSGText.h +82 -0
- package/cpp/skia/modules/sksg/include/SkSGTransform.h +127 -0
- package/cpp/skia/src/base/SkArenaAlloc.h +371 -0
- package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/commonjs/dom/types/Drawings.d.ts +5 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +2 -1
- package/lib/commonjs/dom/types/NodeType.js +2 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/commonjs/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -0
- package/lib/commonjs/renderer/components/Skottie.d.ts +4 -0
- package/lib/commonjs/renderer/components/Skottie.js +13 -0
- package/lib/commonjs/renderer/components/Skottie.js.map +1 -0
- package/lib/commonjs/renderer/components/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/index.js +11 -0
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +11 -2
- package/lib/commonjs/skia/types/Matrix4.js +42 -1
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +2 -1
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +2 -0
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/Skottie.d.ts +223 -0
- package/lib/commonjs/skia/types/Skottie.js +73 -0
- package/lib/commonjs/skia/types/Skottie.js.map +1 -0
- package/lib/commonjs/skia/types/index.d.ts +1 -0
- package/lib/commonjs/skia/types/index.js +11 -0
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +88 -19
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +2 -0
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js +243 -0
- package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.js +26 -0
- package/lib/commonjs/skia/web/JsiSkottieFactory.js.map +1 -0
- package/lib/commonjs/sksg/Elements.d.ts +2 -1
- package/lib/commonjs/sksg/Elements.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +4 -2
- package/lib/commonjs/sksg/Recorder/Core.js +1 -0
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +2 -0
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/commonjs/sksg/Recorder/Recorder.js +6 -0
- package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Visitor.js +3 -0
- package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +11 -4
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +1 -1
- package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/module/dom/types/Drawings.d.ts +5 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +2 -1
- package/lib/module/dom/types/NodeType.js +2 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/module/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/module/renderer/__tests__/setup.d.ts +5 -0
- package/lib/module/renderer/components/Skottie.d.ts +4 -0
- package/lib/module/renderer/components/Skottie.js +5 -0
- package/lib/module/renderer/components/Skottie.js.map +1 -0
- package/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/module/renderer/components/index.js +1 -0
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/module/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +11 -2
- package/lib/module/skia/types/Matrix4.js +40 -0
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +2 -1
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +2 -0
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/Skottie.d.ts +223 -0
- package/lib/module/skia/types/Skottie.js +74 -0
- package/lib/module/skia/types/Skottie.js.map +1 -0
- package/lib/module/skia/types/index.d.ts +1 -0
- package/lib/module/skia/types/index.js +1 -0
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +88 -19
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +2 -0
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/module/skia/web/JsiSkottieAnimation.js +236 -0
- package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -0
- package/lib/module/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/module/skia/web/JsiSkottieFactory.js +19 -0
- package/lib/module/skia/web/JsiSkottieFactory.js.map +1 -0
- package/lib/module/sksg/Elements.d.ts +2 -1
- package/lib/module/sksg/Elements.js.map +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +4 -2
- package/lib/module/sksg/Recorder/Core.js +1 -0
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +3 -1
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +4 -0
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/module/sksg/Recorder/Recorder.js +6 -0
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +3 -0
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js +9 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js +1 -1
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/components/Skottie.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/types/Skottie.d.ts +6 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +48 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +6 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +1 -1
- package/lib/typescript/lib/module/mock/index.d.ts +7 -0
- package/lib/typescript/lib/module/renderer/components/Skottie.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/components/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Skottie.d.ts +5 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/module/skia/web/JsiSkottieAnimation.d.ts +47 -0
- package/lib/typescript/lib/module/skia/web/JsiSkottieFactory.d.ts +5 -0
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/commands/Drawing.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +15 -15
- package/lib/typescript/src/dom/types/Drawings.d.ts +5 -1
- package/lib/typescript/src/dom/types/NodeType.d.ts +2 -1
- package/lib/typescript/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
- package/lib/typescript/src/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -0
- package/lib/typescript/src/renderer/components/Skottie.d.ts +4 -0
- package/lib/typescript/src/renderer/components/index.d.ts +1 -0
- package/lib/typescript/src/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
- package/lib/typescript/src/skia/types/Matrix4.d.ts +11 -2
- package/lib/typescript/src/skia/types/Recorder.d.ts +2 -1
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
- package/lib/typescript/src/skia/types/Skottie.d.ts +223 -0
- package/lib/typescript/src/skia/types/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
- package/lib/typescript/src/skia/web/JsiSkottieAnimation.d.ts +59 -0
- package/lib/typescript/src/skia/web/JsiSkottieFactory.d.ts +9 -0
- package/lib/typescript/src/sksg/Elements.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +4 -2
- package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -1
- package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +2 -2
- package/libs/android/arm64-v8a/libjsonreader.a +0 -0
- package/libs/android/armeabi-v7a/libjsonreader.a +0 -0
- package/libs/android/x86/libjsonreader.a +0 -0
- package/libs/android/x86_64/libjsonreader.a +0 -0
- package/libs/apple/libpathops.xcframework/Info.plist +8 -8
- package/libs/apple/libskia.xcframework/Info.plist +14 -14
- package/libs/apple/libskottie.xcframework/Info.plist +14 -14
- package/libs/apple/libskparagraph.xcframework/Info.plist +16 -16
- package/libs/apple/libsksg.xcframework/Info.plist +5 -5
- package/libs/apple/libskshaper.xcframework/Info.plist +14 -14
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +14 -14
- package/libs/apple/libsvg.xcframework/Info.plist +14 -14
- package/package.json +1 -1
- package/react-native-skia.podspec +4 -2
- package/src/__tests__/snapshots/matrix4/camera-corner.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-offset.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-top-left-center.png +0 -0
- package/src/__tests__/snapshots/matrix4/camera-zoom-out.png +0 -0
- package/src/__tests__/snapshots/matrix4/full-rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/scaled-rect.png +0 -0
- package/src/__tests__/snapshots/matrix4/test-perspective.png +0 -0
- package/src/__tests__/snapshots/matrix4/test-perspective2.png +0 -0
- package/src/dom/types/Drawings.ts +6 -0
- package/src/dom/types/NodeType.ts +2 -0
- package/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.tsx +492 -0
- package/src/renderer/__tests__/e2e/Camera.spec.tsx +475 -0
- package/src/renderer/__tests__/e2e/LightingImageFilters.spec.tsx +1478 -0
- package/src/renderer/__tests__/e2e/Skottie.spec.tsx +440 -0
- package/src/renderer/__tests__/e2e/setup/skottie/basic_slots.json +1118 -0
- package/src/renderer/__tests__/e2e/setup/skottie/color-props.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/confetti.json +5899 -0
- package/src/renderer/__tests__/e2e/setup/skottie/drinks.json +43857 -0
- package/src/renderer/__tests__/e2e/setup/skottie/fingerprint.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/lego_loader.json +29540 -0
- package/src/renderer/__tests__/e2e/setup/skottie/new-drop.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/onboarding.json +1 -0
- package/src/renderer/__tests__/e2e/setup/skottie/text-layer.json +1 -0
- package/src/renderer/__tests__/setup.tsx +23 -0
- package/src/renderer/components/Skottie.tsx +8 -0
- package/src/renderer/components/index.ts +1 -0
- package/src/skia/__tests__/assets/Avenir-Heavy.ttf +0 -0
- package/src/skia/types/ImageFilter/ImageFilterFactory.ts +391 -21
- package/src/skia/types/Matrix4.ts +108 -2
- package/src/skia/types/Recorder.ts +2 -0
- package/src/skia/types/Skia.ts +2 -0
- package/src/skia/types/Skottie.ts +266 -0
- package/src/skia/types/index.ts +1 -0
- package/src/skia/web/JsiSkImageFilterFactory.ts +266 -31
- package/src/skia/web/JsiSkia.ts +2 -0
- package/src/skia/web/JsiSkottieAnimation.ts +259 -0
- package/src/skia/web/JsiSkottieFactory.ts +25 -0
- package/src/sksg/Elements.tsx +2 -0
- package/src/sksg/Recorder/Core.ts +3 -0
- package/src/sksg/Recorder/Player.ts +3 -0
- package/src/sksg/Recorder/ReanimatedRecorder.ts +6 -0
- package/src/sksg/Recorder/Recorder.ts +5 -0
- package/src/sksg/Recorder/Visitor.ts +3 -0
- package/src/sksg/Recorder/commands/Drawing.ts +7 -3
- package/src/sksg/Recorder/commands/ImageFilters.ts +1 -1
@@ -0,0 +1,236 @@
|
|
1
|
+
import { HostObject } from "./Host";
|
2
|
+
import { JsiSkTypeface } from "./JsiSkTypeface";
|
3
|
+
import { Color } from "./JsiSkColor";
|
4
|
+
import { JsiSkRect } from "./JsiSkRect";
|
5
|
+
export class JsiSkottieAnimation extends HostObject {
|
6
|
+
constructor(CanvasKit, ref) {
|
7
|
+
super(CanvasKit, ref, "SkottieAnimation");
|
8
|
+
}
|
9
|
+
getOpacityProps() {
|
10
|
+
return this.ref.getOpacityProps();
|
11
|
+
}
|
12
|
+
getTextProps() {
|
13
|
+
return this.ref.getTextProps();
|
14
|
+
}
|
15
|
+
getColorProps() {
|
16
|
+
return this.ref.getColorProps().map(({
|
17
|
+
key,
|
18
|
+
value
|
19
|
+
}) => ({
|
20
|
+
key,
|
21
|
+
value: Color(value)
|
22
|
+
}));
|
23
|
+
}
|
24
|
+
getTransformProps() {
|
25
|
+
return this.ref.getTransformProps().map(({
|
26
|
+
key,
|
27
|
+
value
|
28
|
+
}) => ({
|
29
|
+
key,
|
30
|
+
value: {
|
31
|
+
anchor: {
|
32
|
+
x: value.anchor[0],
|
33
|
+
y: value.anchor[1]
|
34
|
+
},
|
35
|
+
position: {
|
36
|
+
x: value.position[0],
|
37
|
+
y: value.position[1]
|
38
|
+
},
|
39
|
+
scale: {
|
40
|
+
x: value.scale[0],
|
41
|
+
y: value.scale[1]
|
42
|
+
},
|
43
|
+
rotation: value.rotation,
|
44
|
+
skew: value.skew,
|
45
|
+
skewAxis: value.skew_axis
|
46
|
+
}
|
47
|
+
}));
|
48
|
+
}
|
49
|
+
setColor(key, color) {
|
50
|
+
return this.ref.setColor(key, color);
|
51
|
+
}
|
52
|
+
setText(key, text, size) {
|
53
|
+
return this.ref.setText(key, text, size);
|
54
|
+
}
|
55
|
+
setOpacity(key, opacity) {
|
56
|
+
return this.ref.setOpacity(key, opacity);
|
57
|
+
}
|
58
|
+
setTransform(key, anchor, position, scale, rotation, skew, skewAxis) {
|
59
|
+
const a = Float32Array.of(anchor.x, anchor.y);
|
60
|
+
const p = Float32Array.of(position.x, position.y);
|
61
|
+
const s = Float32Array.of(scale.x, scale.y);
|
62
|
+
return this.ref.setTransform(key, a, p, s, rotation, skew, skewAxis);
|
63
|
+
}
|
64
|
+
getSlotInfo() {
|
65
|
+
return this.ref.getSlotInfo();
|
66
|
+
}
|
67
|
+
setColorSlot(key, color) {
|
68
|
+
return this.ref.setColorSlot(key, color);
|
69
|
+
}
|
70
|
+
setScalarSlot(key, scalar) {
|
71
|
+
return this.ref.setScalarSlot(key, scalar);
|
72
|
+
}
|
73
|
+
setVec2Slot(key, vec2) {
|
74
|
+
return this.ref.setVec2Slot(key, Float32Array.of(vec2.x, vec2.y));
|
75
|
+
}
|
76
|
+
setTextSlot(key, text) {
|
77
|
+
var _text$text, _text$textSize, _text$minTextSize, _text$maxTextSize, _text$strokeWidth, _text$lineHeight, _text$lineShift;
|
78
|
+
const txt = {
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
80
|
+
// @ts-expect-error
|
81
|
+
typeface: text.typeface && text.typeface instanceof JsiSkTypeface ? text.typeface.ref : null,
|
82
|
+
text: (_text$text = text.text) !== null && _text$text !== void 0 ? _text$text : "",
|
83
|
+
textSize: (_text$textSize = text.textSize) !== null && _text$textSize !== void 0 ? _text$textSize : 0,
|
84
|
+
minTextSize: (_text$minTextSize = text.minTextSize) !== null && _text$minTextSize !== void 0 ? _text$minTextSize : 0,
|
85
|
+
maxTextSize: (_text$maxTextSize = text.maxTextSize) !== null && _text$maxTextSize !== void 0 ? _text$maxTextSize : Number.MAX_VALUE,
|
86
|
+
strokeWidth: (_text$strokeWidth = text.strokeWidth) !== null && _text$strokeWidth !== void 0 ? _text$strokeWidth : 0,
|
87
|
+
lineHeight: (_text$lineHeight = text.lineHeight) !== null && _text$lineHeight !== void 0 ? _text$lineHeight : 0,
|
88
|
+
lineShift: (_text$lineShift = text.lineShift) !== null && _text$lineShift !== void 0 ? _text$lineShift : 0,
|
89
|
+
ascent: text.ascent,
|
90
|
+
maxLines: text.maxLines,
|
91
|
+
// TODO: implement
|
92
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
93
|
+
//@ts-expect-error
|
94
|
+
horizAlign: this.CanvasKit.TextAlign.Left,
|
95
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
96
|
+
//@ts-expect-error
|
97
|
+
vertAlign: this.CanvasKit.VerticalTextAlign.Top,
|
98
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
99
|
+
//@ts-expect-error
|
100
|
+
strokeJoin: this.CanvasKit.StrokeJoin.Miter,
|
101
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
102
|
+
//@ts-expect-error
|
103
|
+
direction: this.CanvasKit.TextDirection.LTR,
|
104
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
105
|
+
// @ts-expect-error
|
106
|
+
linebreak: this.CanvasKit.LineBreakType.HardLineBreak,
|
107
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
108
|
+
// @ts-expect-error
|
109
|
+
resize: this.CanvasKit.ResizePolicy.None,
|
110
|
+
boundingBox: text.boundingBox ? this.CanvasKit.XYWHRect(text.boundingBox.x, text.boundingBox.y, text.boundingBox.width, text.boundingBox.height) : [0, 0, 0, 0],
|
111
|
+
fillColor: text.fillColor ? Color(text.fillColor) : this.CanvasKit.TRANSPARENT,
|
112
|
+
strokeColor: text.strokeColor ? Color(text.strokeColor) : this.CanvasKit.TRANSPARENT
|
113
|
+
};
|
114
|
+
return this.ref.setTextSlot(key, txt);
|
115
|
+
}
|
116
|
+
setImageSlot(key, assetName) {
|
117
|
+
return this.ref.setImageSlot(key, assetName);
|
118
|
+
}
|
119
|
+
getColorSlot(key) {
|
120
|
+
const color = this.ref.getColorSlot(key);
|
121
|
+
return color;
|
122
|
+
}
|
123
|
+
getScalarSlot(key) {
|
124
|
+
return this.ref.getScalarSlot(key);
|
125
|
+
}
|
126
|
+
getVec2Slot(key) {
|
127
|
+
const vec2 = this.ref.getVec2Slot(key);
|
128
|
+
if (!vec2) {
|
129
|
+
return null;
|
130
|
+
}
|
131
|
+
return {
|
132
|
+
x: vec2[0],
|
133
|
+
y: vec2[1]
|
134
|
+
};
|
135
|
+
}
|
136
|
+
getTextSlot(key) {
|
137
|
+
const result = this.ref.getTextSlot(key);
|
138
|
+
const textSlot = {};
|
139
|
+
if (result) {
|
140
|
+
if (result.typeface) {
|
141
|
+
textSlot.typeface = new JsiSkTypeface(this.CanvasKit, result.typeface);
|
142
|
+
}
|
143
|
+
if (result.text) {
|
144
|
+
textSlot.text = result.text;
|
145
|
+
}
|
146
|
+
if (result.textSize) {
|
147
|
+
textSlot.textSize = result.textSize;
|
148
|
+
}
|
149
|
+
if (result.minTextSize) {
|
150
|
+
textSlot.minTextSize = result.minTextSize;
|
151
|
+
}
|
152
|
+
if (result.maxTextSize) {
|
153
|
+
textSlot.maxTextSize = result.maxTextSize;
|
154
|
+
}
|
155
|
+
if (result.strokeWidth) {
|
156
|
+
textSlot.strokeWidth = result.strokeWidth;
|
157
|
+
}
|
158
|
+
if (result.lineHeight) {
|
159
|
+
textSlot.lineHeight = result.lineHeight;
|
160
|
+
}
|
161
|
+
if (result.lineShift) {
|
162
|
+
textSlot.lineShift = result.lineShift;
|
163
|
+
}
|
164
|
+
if (result.ascent) {
|
165
|
+
textSlot.ascent = result.ascent;
|
166
|
+
}
|
167
|
+
if (result.maxLines) {
|
168
|
+
textSlot.maxLines = result.maxLines;
|
169
|
+
}
|
170
|
+
// if (result.horizAlign) {
|
171
|
+
// textSlot.horizAlign = result.horizAlign;
|
172
|
+
// }
|
173
|
+
// if (result.vertAlign) {
|
174
|
+
// textSlot.vertAlign = result.vertAlign;
|
175
|
+
// }
|
176
|
+
// if (result.strokeJoin) {
|
177
|
+
// textSlot.strokeJoin = result.strokeJoin;
|
178
|
+
// }
|
179
|
+
// if (result.direction) {
|
180
|
+
// textSlot.direction = result.direction;
|
181
|
+
// }
|
182
|
+
// if (result.linebreak) {
|
183
|
+
// textSlot.linebreak = result.linebreak;
|
184
|
+
// }
|
185
|
+
// if (result.resize) {
|
186
|
+
// textSlot.resize = result.resize;
|
187
|
+
// }
|
188
|
+
// if (result.boundingBox) {
|
189
|
+
// textSlot.boundingBox = new JsiSkRect(
|
190
|
+
// this.CanvasKit,
|
191
|
+
// result.boundingBox
|
192
|
+
// );
|
193
|
+
// }
|
194
|
+
// if (result.fillColor) {
|
195
|
+
// textSlot.fillColor = Color(result.fillColor);
|
196
|
+
// }
|
197
|
+
// if (result.strokeColor) {
|
198
|
+
// textSlot.strokeColor = Color(result.strokeColor);
|
199
|
+
// }
|
200
|
+
}
|
201
|
+
return textSlot;
|
202
|
+
}
|
203
|
+
duration() {
|
204
|
+
return this.ref.duration();
|
205
|
+
}
|
206
|
+
fps() {
|
207
|
+
return this.ref.fps();
|
208
|
+
}
|
209
|
+
render(canvas, dstRect) {
|
210
|
+
const [width, height] = this.ref.size();
|
211
|
+
this.ref.render(canvas.ref, dstRect && dstRect instanceof JsiSkRect ? dstRect.ref : Float32Array.of(0, 0, width, height));
|
212
|
+
}
|
213
|
+
seekFrame(frame, damageRect) {
|
214
|
+
const result = this.ref.seekFrame(frame);
|
215
|
+
if (damageRect && damageRect instanceof JsiSkRect) {
|
216
|
+
damageRect.ref[0] = result[0];
|
217
|
+
damageRect.ref[1] = result[1];
|
218
|
+
damageRect.ref[2] = result[2];
|
219
|
+
damageRect.ref[3] = result[3];
|
220
|
+
}
|
221
|
+
}
|
222
|
+
size() {
|
223
|
+
const [width, height] = this.ref.size();
|
224
|
+
return {
|
225
|
+
width,
|
226
|
+
height
|
227
|
+
};
|
228
|
+
}
|
229
|
+
version() {
|
230
|
+
return this.ref.version();
|
231
|
+
}
|
232
|
+
dispose() {
|
233
|
+
this.ref.delete();
|
234
|
+
}
|
235
|
+
}
|
236
|
+
//# sourceMappingURL=JsiSkottieAnimation.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["HostObject","JsiSkTypeface","Color","JsiSkRect","JsiSkottieAnimation","constructor","CanvasKit","ref","getOpacityProps","getTextProps","getColorProps","map","key","value","getTransformProps","anchor","x","y","position","scale","rotation","skew","skewAxis","skew_axis","setColor","color","setText","text","size","setOpacity","opacity","setTransform","a","Float32Array","of","p","s","getSlotInfo","setColorSlot","setScalarSlot","scalar","setVec2Slot","vec2","setTextSlot","_text$text","_text$textSize","_text$minTextSize","_text$maxTextSize","_text$strokeWidth","_text$lineHeight","_text$lineShift","txt","typeface","textSize","minTextSize","maxTextSize","Number","MAX_VALUE","strokeWidth","lineHeight","lineShift","ascent","maxLines","horizAlign","TextAlign","Left","vertAlign","VerticalTextAlign","Top","strokeJoin","StrokeJoin","Miter","direction","TextDirection","LTR","linebreak","LineBreakType","HardLineBreak","resize","ResizePolicy","None","boundingBox","XYWHRect","width","height","fillColor","TRANSPARENT","strokeColor","setImageSlot","assetName","getColorSlot","getScalarSlot","getVec2Slot","getTextSlot","result","textSlot","duration","fps","render","canvas","dstRect","seekFrame","frame","damageRect","version","dispose","delete"],"sources":["JsiSkottieAnimation.ts"],"sourcesContent":["import type {\n CanvasKit,\n ManagedSkottieAnimation,\n SlottableTextProperty as CKSlottableTextProperty,\n} from \"canvaskit-wasm\";\n\nimport type {\n SkSkottieAnimation,\n SlotInfo,\n SlottableTextProperty,\n} from \"../types/Skottie\";\nimport type { SkColor, SkPoint, SkRect } from \"../types\";\n\nimport { HostObject } from \"./Host\";\nimport type { JsiSkCanvas } from \"./JsiSkCanvas\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkRect } from \"./JsiSkRect\";\n\nexport class JsiSkottieAnimation\n extends HostObject<ManagedSkottieAnimation, \"SkottieAnimation\">\n implements SkSkottieAnimation\n{\n constructor(CanvasKit: CanvasKit, ref: ManagedSkottieAnimation) {\n super(CanvasKit, ref, \"SkottieAnimation\");\n }\n getOpacityProps() {\n return this.ref.getOpacityProps();\n }\n getTextProps() {\n return this.ref.getTextProps();\n }\n getColorProps() {\n return this.ref\n .getColorProps()\n .map(({ key, value }) => ({ key, value: Color(value) }));\n }\n getTransformProps() {\n return this.ref.getTransformProps().map(({ key, value }) => ({\n key,\n value: {\n anchor: { x: value.anchor[0], y: value.anchor[1] },\n position: { x: value.position[0], y: value.position[1] },\n scale: { x: value.scale[0], y: value.scale[1] },\n rotation: value.rotation,\n skew: value.skew,\n skewAxis: value.skew_axis,\n },\n }));\n }\n setColor(key: string, color: SkColor) {\n return this.ref.setColor(key, color);\n }\n setText(key: string, text: string, size: number) {\n return this.ref.setText(key, text, size);\n }\n setOpacity(key: string, opacity: number) {\n return this.ref.setOpacity(key, opacity);\n }\n setTransform(\n key: string,\n anchor: SkPoint,\n position: SkPoint,\n scale: SkPoint,\n rotation: number,\n skew: number,\n skewAxis: number\n ) {\n const a = Float32Array.of(anchor.x, anchor.y);\n const p = Float32Array.of(position.x, position.y);\n const s = Float32Array.of(scale.x, scale.y);\n return this.ref.setTransform(key, a, p, s, rotation, skew, skewAxis);\n }\n\n getSlotInfo(): SlotInfo {\n return this.ref.getSlotInfo();\n }\n setColorSlot(key: string, color: SkColor) {\n return this.ref.setColorSlot(key, color);\n }\n setScalarSlot(key: string, scalar: number) {\n return this.ref.setScalarSlot(key, scalar);\n }\n setVec2Slot(key: string, vec2: SkPoint) {\n return this.ref.setVec2Slot(key, Float32Array.of(vec2.x, vec2.y));\n }\n setTextSlot(key: string, text: SlottableTextProperty): boolean {\n const txt: CKSlottableTextProperty = {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n typeface:\n text.typeface && text.typeface instanceof JsiSkTypeface\n ? text.typeface.ref\n : null,\n text: text.text ?? \"\",\n textSize: text.textSize ?? 0,\n minTextSize: text.minTextSize ?? 0,\n maxTextSize: text.maxTextSize ?? Number.MAX_VALUE,\n strokeWidth: text.strokeWidth ?? 0,\n lineHeight: text.lineHeight ?? 0,\n lineShift: text.lineShift ?? 0,\n ascent: text.ascent,\n maxLines: text.maxLines,\n // TODO: implement\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-expect-error\n horizAlign: this.CanvasKit.TextAlign.Left,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-expect-error\n vertAlign: this.CanvasKit.VerticalTextAlign.Top,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-expect-error\n strokeJoin: this.CanvasKit.StrokeJoin.Miter,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-expect-error\n direction: this.CanvasKit.TextDirection.LTR,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n linebreak: this.CanvasKit.LineBreakType.HardLineBreak,\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n resize: this.CanvasKit.ResizePolicy.None,\n boundingBox: text.boundingBox\n ? this.CanvasKit.XYWHRect(\n text.boundingBox.x,\n text.boundingBox.y,\n text.boundingBox.width,\n text.boundingBox.height\n )\n : [0, 0, 0, 0],\n fillColor: text.fillColor\n ? Color(text.fillColor)\n : this.CanvasKit.TRANSPARENT,\n strokeColor: text.strokeColor\n ? Color(text.strokeColor)\n : this.CanvasKit.TRANSPARENT,\n };\n return this.ref.setTextSlot(key, txt);\n }\n setImageSlot(key: string, assetName: string) {\n return this.ref.setImageSlot(key, assetName);\n }\n getColorSlot(key: string): SkColor | null {\n const color = this.ref.getColorSlot(key);\n return color;\n }\n getScalarSlot(key: string) {\n return this.ref.getScalarSlot(key);\n }\n getVec2Slot(key: string): SkPoint | null {\n const vec2 = this.ref.getVec2Slot(key);\n if (!vec2) {\n return null;\n }\n return { x: vec2[0], y: vec2[1] };\n }\n getTextSlot(key: string): SlottableTextProperty | null {\n const result = this.ref.getTextSlot(key);\n const textSlot: SlottableTextProperty = {};\n if (result) {\n if (result.typeface) {\n textSlot.typeface = new JsiSkTypeface(this.CanvasKit, result.typeface);\n }\n if (result.text) {\n textSlot.text = result.text;\n }\n if (result.textSize) {\n textSlot.textSize = result.textSize;\n }\n if (result.minTextSize) {\n textSlot.minTextSize = result.minTextSize;\n }\n if (result.maxTextSize) {\n textSlot.maxTextSize = result.maxTextSize;\n }\n if (result.strokeWidth) {\n textSlot.strokeWidth = result.strokeWidth;\n }\n if (result.lineHeight) {\n textSlot.lineHeight = result.lineHeight;\n }\n if (result.lineShift) {\n textSlot.lineShift = result.lineShift;\n }\n if (result.ascent) {\n textSlot.ascent = result.ascent;\n }\n if (result.maxLines) {\n textSlot.maxLines = result.maxLines;\n }\n // if (result.horizAlign) {\n // textSlot.horizAlign = result.horizAlign;\n // }\n // if (result.vertAlign) {\n // textSlot.vertAlign = result.vertAlign;\n // }\n // if (result.strokeJoin) {\n // textSlot.strokeJoin = result.strokeJoin;\n // }\n // if (result.direction) {\n // textSlot.direction = result.direction;\n // }\n // if (result.linebreak) {\n // textSlot.linebreak = result.linebreak;\n // }\n // if (result.resize) {\n // textSlot.resize = result.resize;\n // }\n // if (result.boundingBox) {\n // textSlot.boundingBox = new JsiSkRect(\n // this.CanvasKit,\n // result.boundingBox\n // );\n // }\n // if (result.fillColor) {\n // textSlot.fillColor = Color(result.fillColor);\n // }\n // if (result.strokeColor) {\n // textSlot.strokeColor = Color(result.strokeColor);\n // }\n }\n return textSlot;\n }\n\n duration() {\n return this.ref.duration();\n }\n fps() {\n return this.ref.fps();\n }\n render(canvas: JsiSkCanvas, dstRect?: SkRect) {\n const [width, height] = this.ref.size();\n this.ref.render(\n canvas.ref,\n dstRect && dstRect instanceof JsiSkRect\n ? dstRect.ref\n : Float32Array.of(0, 0, width, height)\n );\n }\n seekFrame(frame: number, damageRect?: JsiSkRect) {\n const result = this.ref.seekFrame(frame);\n if (damageRect && damageRect instanceof JsiSkRect) {\n damageRect.ref[0] = result[0];\n damageRect.ref[1] = result[1];\n damageRect.ref[2] = result[2];\n damageRect.ref[3] = result[3];\n }\n }\n size() {\n const [width, height] = this.ref.size();\n return { width, height };\n }\n version() {\n return this.ref.version();\n }\n dispose() {\n this.ref.delete();\n }\n}\n"],"mappings":"AAaA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,SAAS,QAAQ,aAAa;AAEvC,OAAO,MAAMC,mBAAmB,SACtBJ,UAAU,CAEpB;EACEK,WAAWA,CAACC,SAAoB,EAAEC,GAA4B,EAAE;IAC9D,KAAK,CAACD,SAAS,EAAEC,GAAG,EAAE,kBAAkB,CAAC;EAC3C;EACAC,eAAeA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACD,GAAG,CAACC,eAAe,CAAC,CAAC;EACnC;EACAC,YAAYA,CAAA,EAAG;IACb,OAAO,IAAI,CAACF,GAAG,CAACE,YAAY,CAAC,CAAC;EAChC;EACAC,aAAaA,CAAA,EAAG;IACd,OAAO,IAAI,CAACH,GAAG,CACZG,aAAa,CAAC,CAAC,CACfC,GAAG,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAM,CAAC,MAAM;MAAED,GAAG;MAAEC,KAAK,EAAEX,KAAK,CAACW,KAAK;IAAE,CAAC,CAAC,CAAC;EAC5D;EACAC,iBAAiBA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACP,GAAG,CAACO,iBAAiB,CAAC,CAAC,CAACH,GAAG,CAAC,CAAC;MAAEC,GAAG;MAAEC;IAAM,CAAC,MAAM;MAC3DD,GAAG;MACHC,KAAK,EAAE;QACLE,MAAM,EAAE;UAAEC,CAAC,EAAEH,KAAK,CAACE,MAAM,CAAC,CAAC,CAAC;UAAE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;IAC/B;EACF;EACAlE,IAAIA,CAAA,EAAG;IACL,MAAM,CAACuD,KAAK,EAAEC,MAAM,CAAC,GAAG,IAAI,CAAC7E,GAAG,CAACqB,IAAI,CAAC,CAAC;IACvC,OAAO;MAAEuD,KAAK;MAAEC;IAAO,CAAC;EAC1B;EACAoB,OAAOA,CAAA,EAAG;IACR,OAAO,IAAI,CAACjG,GAAG,CAACiG,OAAO,CAAC,CAAC;EAC3B;EACAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAAClG,GAAG,CAACmG,MAAM,CAAC,CAAC;EACnB;AACF","ignoreList":[]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { CanvasKit } from "canvaskit-wasm";
|
2
|
+
import type { SkottieFactory } from "../types";
|
3
|
+
import { Host } from "./Host";
|
4
|
+
import { JsiSkottieAnimation } from "./JsiSkottieAnimation";
|
5
|
+
import type { JsiSkData } from "./JsiSkData";
|
6
|
+
export declare class JsiSkottieFactory extends Host implements SkottieFactory {
|
7
|
+
constructor(CanvasKit: CanvasKit);
|
8
|
+
Make(json: string, assets?: Record<string, JsiSkData>): JsiSkottieAnimation;
|
9
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Host } from "./Host";
|
2
|
+
import { JsiSkottieAnimation } from "./JsiSkottieAnimation";
|
3
|
+
export class JsiSkottieFactory extends Host {
|
4
|
+
constructor(CanvasKit) {
|
5
|
+
super(CanvasKit);
|
6
|
+
}
|
7
|
+
Make(json, assets) {
|
8
|
+
const rawAssets = {};
|
9
|
+
for (const [key, value] of Object.entries(assets !== null && assets !== void 0 ? assets : {})) {
|
10
|
+
rawAssets[key] = value.ref;
|
11
|
+
}
|
12
|
+
const animation = this.CanvasKit.MakeManagedAnimation(json, rawAssets);
|
13
|
+
if (!animation) {
|
14
|
+
throw new Error("Failed to create SkottieAnimation");
|
15
|
+
}
|
16
|
+
return new JsiSkottieAnimation(this.CanvasKit, animation);
|
17
|
+
}
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=JsiSkottieFactory.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["Host","JsiSkottieAnimation","JsiSkottieFactory","constructor","CanvasKit","Make","json","assets","rawAssets","key","value","Object","entries","ref","animation","MakeManagedAnimation","Error"],"sources":["JsiSkottieFactory.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type { SkottieFactory } from \"../types\";\n\nimport { Host } from \"./Host\";\nimport { JsiSkottieAnimation } from \"./JsiSkottieAnimation\";\nimport type { JsiSkData } from \"./JsiSkData\";\n\nexport class JsiSkottieFactory extends Host implements SkottieFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n Make(json: string, assets?: Record<string, JsiSkData>) {\n const rawAssets: { [key: string]: ArrayBuffer } = {};\n for (const [key, value] of Object.entries(assets ?? {})) {\n rawAssets[key] = value.ref;\n }\n const animation = this.CanvasKit.MakeManagedAnimation(json, rawAssets);\n if (!animation) {\n throw new Error(\"Failed to create SkottieAnimation\");\n }\n return new JsiSkottieAnimation(this.CanvasKit, animation);\n }\n}\n"],"mappings":"AAIA,SAASA,IAAI,QAAQ,QAAQ;AAC7B,SAASC,mBAAmB,QAAQ,uBAAuB;AAG3D,OAAO,MAAMC,iBAAiB,SAASF,IAAI,CAA2B;EACpEG,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,IAAIA,CAACC,IAAY,EAAEC,MAAkC,EAAE;IACrD,MAAMC,SAAyC,GAAG,CAAC,CAAC;IACpD,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,CAAC,CAAC,CAAC,EAAE;MACvDC,SAAS,CAACC,GAAG,CAAC,GAAGC,KAAK,CAACG,GAAG;IAC5B;IACA,MAAMC,SAAS,GAAG,IAAI,CAACV,SAAS,CAACW,oBAAoB,CAACT,IAAI,EAAEE,SAAS,CAAC;IACtE,IAAI,CAACM,SAAS,EAAE;MACd,MAAM,IAAIE,KAAK,CAAC,mCAAmC,CAAC;IACtD;IACA,OAAO,IAAIf,mBAAmB,CAAC,IAAI,CAACG,SAAS,EAAEU,SAAS,CAAC;EAC3D;AACF","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { FractalNoiseProps, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps, AtlasProps, ChildrenProps, MorphologyImageFilterProps, BlendProps } from "../dom/types";
|
1
|
+
import type { FractalNoiseProps, CircleProps, DrawingNodeProps, ImageProps, PaintProps, PathProps, LineProps, OvalProps, DiffRectProps, PointsProps, RectProps, RoundedRectProps, TextProps, VerticesProps, BlurMaskFilterProps, BlendImageFilterProps, BlurImageFilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps, MatrixColorFilterProps, ShaderProps, ImageShaderProps, LinearGradientProps, GroupProps, PatchProps, BlendColorFilterProps, DashPathEffectProps, DiscretePathEffectProps, CornerPathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, BoxProps, BoxShadowProps, ParagraphProps, AtlasProps, ChildrenProps, MorphologyImageFilterProps, BlendProps, SkottieProps } from "../dom/types";
|
2
2
|
import type { SkiaProps } from "../renderer";
|
3
3
|
declare module "react" {
|
4
4
|
namespace JSX {
|
@@ -23,6 +23,7 @@ declare module "react" {
|
|
23
23
|
skTextBlob: SkiaProps<TextBlobProps>;
|
24
24
|
skGlyphs: SkiaProps<GlyphsProps>;
|
25
25
|
skDiffRect: SkiaProps<DiffRectProps>;
|
26
|
+
skSkottie: SkiaProps<SkottieProps>;
|
26
27
|
skPicture: SkiaProps<PictureProps>;
|
27
28
|
skImageSVG: SkiaProps<ImageSVGProps>;
|
28
29
|
skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["Elements.tsx"],"sourcesContent":["import type {\n FractalNoiseProps,\n CircleProps,\n DrawingNodeProps,\n ImageProps,\n PaintProps,\n PathProps,\n LineProps,\n OvalProps,\n DiffRectProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextProps,\n VerticesProps,\n BlurMaskFilterProps,\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n MatrixColorFilterProps,\n ShaderProps,\n ImageShaderProps,\n LinearGradientProps,\n GroupProps,\n PatchProps,\n BlendColorFilterProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n CornerPathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n BoxProps,\n BoxShadowProps,\n ParagraphProps,\n AtlasProps,\n ChildrenProps,\n MorphologyImageFilterProps,\n BlendProps,\n} from \"../dom/types\";\nimport type { SkiaProps } from \"../renderer\";\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n skGroup: SkiaProps<GroupProps>;\n skLayer: SkiaProps<ChildrenProps>;\n skPaint: SkiaProps<PaintProps>;\n\n // Drawings\n skFill: SkiaProps<DrawingNodeProps>;\n skImage: SkiaProps<ImageProps>;\n skCircle: SkiaProps<CircleProps>;\n skPath: SkiaProps<PathProps>;\n skLine: SkiaProps<LineProps>;\n skOval: SkiaProps<OvalProps>;\n skPatch: SkiaProps<PatchProps>;\n skPoints: SkiaProps<PointsProps>;\n skRect: SkiaProps<RectProps>;\n skRRect: SkiaProps<RoundedRectProps>;\n skAtlas: SkiaProps<AtlasProps>;\n skVertices: SkiaProps<VerticesProps>;\n skText: SkiaProps<TextProps>;\n skTextPath: SkiaProps<TextPathProps>;\n skTextBlob: SkiaProps<TextBlobProps>;\n skGlyphs: SkiaProps<GlyphsProps>;\n skDiffRect: SkiaProps<DiffRectProps>;\n skPicture: SkiaProps<PictureProps>;\n skImageSVG: SkiaProps<ImageSVGProps>;\n\n // BlurMaskFilters\n skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;\n\n // ImageFilters\n skBlendImageFilter: SkiaProps<BlendImageFilterProps>;\n skBlurImageFilter: SkiaProps<BlurImageFilterProps>;\n skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;\n skDropShadowImageFilter: SkiaProps<DropShadowImageFilterProps>;\n skDisplacementMapImageFilter: SkiaProps<DisplacementMapImageFilterProps>;\n skRuntimeShaderImageFilter: SkiaProps<RuntimeShaderImageFilterProps>;\n skMorphologyImageFilter: SkiaProps<MorphologyImageFilterProps>;\n\n // ColorFilters\n skMatrixColorFilter: SkiaProps<MatrixColorFilterProps>;\n skBlendColorFilter: SkiaProps<BlendColorFilterProps>;\n skLinearToSRGBGammaColorFilter: SkiaProps<ChildrenProps>;\n skSRGBToLinearGammaColorFilter: SkiaProps<ChildrenProps>;\n skLumaColorFilter: SkiaProps<ChildrenProps>;\n skLerpColorFilter: SkiaProps<LerpColorFilterProps>;\n\n // Shaders\n skShader: SkiaProps<ShaderProps>;\n skImageShader: SkiaProps<ImageShaderProps>;\n skColorShader: SkiaProps<ColorProps>;\n skTurbulence: SkiaProps<TurbulenceProps>;\n skFractalNoise: SkiaProps<FractalNoiseProps>;\n skLinearGradient: SkiaProps<LinearGradientProps>;\n skRadialGradient: SkiaProps<RadialGradientProps>;\n skSweepGradient: SkiaProps<SweepGradientProps>;\n skTwoPointConicalGradient: SkiaProps<TwoPointConicalGradientProps>;\n\n // Path Effects\n skDiscretePathEffect: SkiaProps<DiscretePathEffectProps>;\n skDashPathEffect: SkiaProps<DashPathEffectProps>;\n skPath1DPathEffect: SkiaProps<Path1DPathEffectProps>;\n skPath2DPathEffect: SkiaProps<Path2DPathEffectProps>;\n skCornerPathEffect: SkiaProps<CornerPathEffectProps>;\n skSumPathEffect: ChildrenProps;\n skLine2DPathEffect: SkiaProps<Line2DPathEffectProps>;\n\n // Mixed declarations/drawings\n skBlend: SkiaProps<BlendProps>;\n skBackdropFilter: SkiaProps<ChildrenProps>;\n skBox: SkiaProps<BoxProps>;\n skBoxShadow: SkiaProps<BoxShadowProps>;\n\n // Paragraph\n skParagraph: SkiaProps<ParagraphProps>;\n }\n }\n}\n"],"mappings":"","ignoreList":[]}
|
1
|
+
{"version":3,"names":[],"sources":["Elements.tsx"],"sourcesContent":["import type {\n FractalNoiseProps,\n CircleProps,\n DrawingNodeProps,\n ImageProps,\n PaintProps,\n PathProps,\n LineProps,\n OvalProps,\n DiffRectProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextProps,\n VerticesProps,\n BlurMaskFilterProps,\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n MatrixColorFilterProps,\n ShaderProps,\n ImageShaderProps,\n LinearGradientProps,\n GroupProps,\n PatchProps,\n BlendColorFilterProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n CornerPathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n TwoPointConicalGradientProps,\n TurbulenceProps,\n SweepGradientProps,\n RadialGradientProps,\n ColorProps,\n PictureProps,\n ImageSVGProps,\n LerpColorFilterProps,\n BoxProps,\n BoxShadowProps,\n ParagraphProps,\n AtlasProps,\n ChildrenProps,\n MorphologyImageFilterProps,\n BlendProps,\n SkottieProps,\n} from \"../dom/types\";\nimport type { SkiaProps } from \"../renderer\";\n\ndeclare module \"react\" {\n // eslint-disable-next-line @typescript-eslint/no-namespace\n namespace JSX {\n interface IntrinsicElements {\n skGroup: SkiaProps<GroupProps>;\n skLayer: SkiaProps<ChildrenProps>;\n skPaint: SkiaProps<PaintProps>;\n\n // Drawings\n skFill: SkiaProps<DrawingNodeProps>;\n skImage: SkiaProps<ImageProps>;\n skCircle: SkiaProps<CircleProps>;\n skPath: SkiaProps<PathProps>;\n skLine: SkiaProps<LineProps>;\n skOval: SkiaProps<OvalProps>;\n skPatch: SkiaProps<PatchProps>;\n skPoints: SkiaProps<PointsProps>;\n skRect: SkiaProps<RectProps>;\n skRRect: SkiaProps<RoundedRectProps>;\n skAtlas: SkiaProps<AtlasProps>;\n skVertices: SkiaProps<VerticesProps>;\n skText: SkiaProps<TextProps>;\n skTextPath: SkiaProps<TextPathProps>;\n skTextBlob: SkiaProps<TextBlobProps>;\n skGlyphs: SkiaProps<GlyphsProps>;\n skDiffRect: SkiaProps<DiffRectProps>;\n skSkottie: SkiaProps<SkottieProps>;\n skPicture: SkiaProps<PictureProps>;\n skImageSVG: SkiaProps<ImageSVGProps>;\n\n // BlurMaskFilters\n skBlurMaskFilter: SkiaProps<BlurMaskFilterProps>;\n\n // ImageFilters\n skBlendImageFilter: SkiaProps<BlendImageFilterProps>;\n skBlurImageFilter: SkiaProps<BlurImageFilterProps>;\n skOffsetImageFilter: SkiaProps<OffsetImageFilterProps>;\n skDropShadowImageFilter: SkiaProps<DropShadowImageFilterProps>;\n skDisplacementMapImageFilter: SkiaProps<DisplacementMapImageFilterProps>;\n skRuntimeShaderImageFilter: SkiaProps<RuntimeShaderImageFilterProps>;\n skMorphologyImageFilter: SkiaProps<MorphologyImageFilterProps>;\n\n // ColorFilters\n skMatrixColorFilter: SkiaProps<MatrixColorFilterProps>;\n skBlendColorFilter: SkiaProps<BlendColorFilterProps>;\n skLinearToSRGBGammaColorFilter: SkiaProps<ChildrenProps>;\n skSRGBToLinearGammaColorFilter: SkiaProps<ChildrenProps>;\n skLumaColorFilter: SkiaProps<ChildrenProps>;\n skLerpColorFilter: SkiaProps<LerpColorFilterProps>;\n\n // Shaders\n skShader: SkiaProps<ShaderProps>;\n skImageShader: SkiaProps<ImageShaderProps>;\n skColorShader: SkiaProps<ColorProps>;\n skTurbulence: SkiaProps<TurbulenceProps>;\n skFractalNoise: SkiaProps<FractalNoiseProps>;\n skLinearGradient: SkiaProps<LinearGradientProps>;\n skRadialGradient: SkiaProps<RadialGradientProps>;\n skSweepGradient: SkiaProps<SweepGradientProps>;\n skTwoPointConicalGradient: SkiaProps<TwoPointConicalGradientProps>;\n\n // Path Effects\n skDiscretePathEffect: SkiaProps<DiscretePathEffectProps>;\n skDashPathEffect: SkiaProps<DashPathEffectProps>;\n skPath1DPathEffect: SkiaProps<Path1DPathEffectProps>;\n skPath2DPathEffect: SkiaProps<Path2DPathEffectProps>;\n skCornerPathEffect: SkiaProps<CornerPathEffectProps>;\n skSumPathEffect: ChildrenProps;\n skLine2DPathEffect: SkiaProps<Line2DPathEffectProps>;\n\n // Mixed declarations/drawings\n skBlend: SkiaProps<BlendProps>;\n skBackdropFilter: SkiaProps<ChildrenProps>;\n skBox: SkiaProps<BoxProps>;\n skBoxShadow: SkiaProps<BoxShadowProps>;\n\n // Paragraph\n skParagraph: SkiaProps<ParagraphProps>;\n }\n }\n}\n"],"mappings":"","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
|
1
|
+
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps, SkottieProps } from "../../dom/types";
|
2
2
|
export declare enum CommandType {
|
3
3
|
Group = 0,
|
4
4
|
SavePaint = 1,
|
@@ -37,7 +37,8 @@ export declare enum CommandType {
|
|
37
37
|
DrawPicture = 34,
|
38
38
|
DrawImageSVG = 35,
|
39
39
|
DrawParagraph = 36,
|
40
|
-
DrawAtlas = 37
|
40
|
+
DrawAtlas = 37,
|
41
|
+
DrawSkottie = 38
|
41
42
|
}
|
42
43
|
export type Command<T extends CommandType = CommandType> = {
|
43
44
|
type: T;
|
@@ -72,6 +73,7 @@ interface Props {
|
|
72
73
|
[CommandType.DrawImageSVG]: ImageSVGProps;
|
73
74
|
[CommandType.DrawParagraph]: ParagraphProps;
|
74
75
|
[CommandType.DrawAtlas]: AtlasProps;
|
76
|
+
[CommandType.DrawSkottie]: SkottieProps;
|
75
77
|
}
|
76
78
|
interface DrawCommand<T extends CommandType> extends Command<T> {
|
77
79
|
props: T extends keyof Props ? Props[T] : never;
|
@@ -81,6 +81,7 @@ export let CommandType = /*#__PURE__*/function (CommandType) {
|
|
81
81
|
CommandType[CommandType["DrawImageSVG"] = 35] = "DrawImageSVG";
|
82
82
|
CommandType[CommandType["DrawParagraph"] = 36] = "DrawParagraph";
|
83
83
|
CommandType[CommandType["DrawAtlas"] = 37] = "DrawAtlas";
|
84
|
+
CommandType[CommandType["DrawSkottie"] = 38] = "DrawSkottie";
|
84
85
|
return CommandType;
|
85
86
|
}({});
|
86
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["CommandType","materializeCommand","command","newProps","props","animatedProps","key","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const materializeCommand = (command: any) => {\n \"worklet\";\n const newProps = { ...command.props };\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n newProps[key] = command.animatedProps[key].value;\n }\n }\n return { ...command, props: newProps };\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"
|
1
|
+
{"version":3,"names":["CommandType","materializeCommand","command","newProps","props","animatedProps","key","value","isCommand","type","isGroup","Group","isDrawCommand"],"sources":["Core.ts"],"sourcesContent":["import type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n DrawingNodeProps,\n SkottieProps,\n} from \"../../dom/types\";\n\n// export enum CommandType {\n// // Context\n// Group = \"Group\",\n// SavePaint = \"SavePaint\",\n// RestorePaint = \"RestorePaint\",\n// SaveCTM = \"SaveCTM\",\n// RestoreCTM = \"RestoreCTM\",\n// PushColorFilter = \"PushColorFilter\",\n// PushBlurMaskFilter = \"PushBlurMaskFilter\",\n// PushImageFilter = \"PushImageFilter\",\n// PushPathEffect = \"PushPathEffect\",\n// PushShader = \"PushShader\",\n// ComposeColorFilter = \"ComposeColorFilter\",\n// ComposeImageFilter = \"ComposeImageFilter\",\n// ComposePathEffect = \"ComposePathEffect\",\n// MaterializePaint = \"MaterializePaint\",\n// SaveBackdropFilter = \"SaveBackdropFilter\",\n// SaveLayer = \"SaveLayer\",\n// RestorePaintDeclaration = \"RestorePaintDeclaration\",\n// // Drawing\n// DrawBox = \"DrawBox\",\n// DrawImage = \"DrawImage\",\n// DrawCircle = \"DrawCircle\",\n// DrawPaint = \"DrawPaint\",\n// DrawPoints = \"DrawPoints\",\n// DrawPath = \"DrawPath\",\n// DrawRect = \"DrawRect\",\n// DrawRRect = \"DrawRRect\",\n// DrawOval = \"DrawOval\",\n// DrawLine = \"DrawLine\",\n// DrawPatch = \"DrawPatch\",\n// DrawVertices = \"DrawVertices\",\n// DrawDiffRect = \"DrawDiffRect\",\n// DrawText = \"DrawText\",\n// DrawTextPath = \"DrawTextPath\",\n// DrawTextBlob = \"DrawTextBlob\",\n// DrawGlyphs = \"DrawGlyphs\",\n// DrawPicture = \"DrawPicture\",\n// DrawImageSVG = \"DrawImageSVG\",\n// DrawParagraph = \"DrawParagraph\",\n// DrawAtlas = \"DrawAtlas\",\n// }\nexport enum CommandType {\n // Context\n Group,\n SavePaint,\n RestorePaint,\n SaveCTM,\n RestoreCTM,\n PushColorFilter,\n PushBlurMaskFilter,\n PushImageFilter,\n PushPathEffect,\n PushShader,\n ComposeColorFilter,\n ComposeImageFilter,\n ComposePathEffect,\n MaterializePaint,\n SaveBackdropFilter,\n SaveLayer,\n RestorePaintDeclaration,\n // Drawing\n DrawBox,\n DrawImage,\n DrawCircle,\n DrawPaint,\n DrawPoints,\n DrawPath,\n DrawRect,\n DrawRRect,\n DrawOval,\n DrawLine,\n DrawPatch,\n DrawVertices,\n DrawDiffRect,\n DrawText,\n DrawTextPath,\n DrawTextBlob,\n DrawGlyphs,\n DrawPicture,\n DrawImageSVG,\n DrawParagraph,\n DrawAtlas,\n DrawSkottie,\n}\n\nexport type Command<T extends CommandType = CommandType> = {\n type: T;\n [key: string]: unknown;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const materializeCommand = (command: any) => {\n \"worklet\";\n const newProps = { ...command.props };\n if (command.animatedProps) {\n for (const key in command.animatedProps) {\n newProps[key] = command.animatedProps[key].value;\n }\n }\n return { ...command, props: newProps };\n};\n\nexport const isCommand = <T extends CommandType>(\n command: Command,\n type: T\n): command is Command<T> => {\n \"worklet\";\n return command.type === type;\n};\n\ninterface GroupCommand extends Command<CommandType.Group> {\n children: Command[];\n}\n\nexport const isGroup = (command: Command): command is GroupCommand => {\n \"worklet\";\n return command.type === CommandType.Group;\n};\n\ninterface Props {\n [CommandType.DrawImage]: ImageProps;\n [CommandType.DrawCircle]: CircleProps;\n [CommandType.SaveCTM]: CTMProps;\n [CommandType.SavePaint]: DrawingNodeProps;\n [CommandType.PushBlurMaskFilter]: BlurMaskFilterProps;\n [CommandType.DrawPoints]: PointsProps;\n [CommandType.DrawPath]: PathProps;\n [CommandType.DrawRect]: RectProps;\n [CommandType.DrawRRect]: RoundedRectProps;\n [CommandType.DrawOval]: OvalProps;\n [CommandType.DrawLine]: LineProps;\n [CommandType.DrawPatch]: PatchProps;\n [CommandType.DrawVertices]: VerticesProps;\n [CommandType.DrawDiffRect]: DiffRectProps;\n [CommandType.DrawText]: TextProps;\n [CommandType.DrawTextPath]: TextPathProps;\n [CommandType.DrawTextBlob]: TextBlobProps;\n [CommandType.DrawGlyphs]: GlyphsProps;\n [CommandType.DrawPicture]: PictureProps;\n [CommandType.DrawImageSVG]: ImageSVGProps;\n [CommandType.DrawParagraph]: ParagraphProps;\n [CommandType.DrawAtlas]: AtlasProps;\n [CommandType.DrawSkottie]: SkottieProps;\n}\n\ninterface DrawCommand<T extends CommandType> extends Command<T> {\n props: T extends keyof Props ? Props[T] : never;\n}\n\nexport const isDrawCommand = <T extends keyof Props>(\n command: Command,\n type: T\n): command is DrawCommand<T> => {\n \"worklet\";\n return command.type === type;\n};\n"],"mappings":"AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAYA,WAAW,0BAAXA,WAAW;EACrB;EADUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAmBrB;EAnBUA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WAAW;EAAXA,WAAW,CAAXA,WA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@@
|
|
1
|
-
import { drawCircle, drawImage, drawOval, drawPath, drawPoints, drawRect, drawRRect, drawLine, drawAtlas, drawParagraph, drawImageSVG, drawPicture, drawGlyphs, drawTextBlob, drawTextPath, drawText, drawDiffRect, drawVertices, drawPatch } from "./commands/Drawing";
|
1
|
+
import { drawCircle, drawImage, drawOval, drawPath, drawPoints, drawRect, drawRRect, drawLine, drawAtlas, drawParagraph, drawImageSVG, drawPicture, drawGlyphs, drawTextBlob, drawTextPath, drawText, drawDiffRect, drawVertices, drawPatch, drawSkottie } from "./commands/Drawing";
|
2
2
|
import { drawBox, isBoxCommand } from "./commands/Box";
|
3
3
|
import { composeColorFilters, isPushColorFilter, pushColorFilter } from "./commands/ColorFilters";
|
4
4
|
import { saveCTM } from "./commands/CTM";
|
@@ -112,6 +112,8 @@ function play(ctx, _command) {
|
|
112
112
|
drawParagraph(ctx, command.props);
|
113
113
|
} else if (isDrawCommand(command, CommandType.DrawAtlas)) {
|
114
114
|
drawAtlas(ctx, command.props);
|
115
|
+
} else if (isDrawCommand(command, CommandType.DrawSkottie)) {
|
116
|
+
drawSkottie(ctx, command.props);
|
115
117
|
} else {
|
116
118
|
console.warn(`Unknown command: ${command.type}`);
|
117
119
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","play","ctx","_command","children","forEach","child","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","standalone","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(\n ctx.Skia,\n ctx,\n command.props,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (command as any).standalone\n );\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n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drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawSkottie","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","play","ctx","_command","children","forEach","child","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","standalone","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","copy","setAlphaf","getAlphaf","getOpacity","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","DrawSkottie","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n drawSkottie,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n} from \"./Core\";\nimport type { Command } from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(\n ctx.Skia,\n ctx,\n command.props,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (command as any).standalone\n );\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n // TODO: is a copy needed here?\n // apply opacity to the current paint.\n const paint = ctx.paint.copy();\n paint.setAlphaf(paint.getAlphaf() * ctx.getOpacity());\n const paints = [paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawSkottie)) {\n drawSkottie(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,WAAW,QACN,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,kBAAkB,QACb,QAAQ;AAIf,SA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,CAAC,EAAE;QACxD7F,SAAS,CAACkC,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAC/B,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAACkE,WAAW,CAAC,EAAE;QAC1DnF,WAAW,CAACuB,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MACjC,CAAC,MAAM;QACL6C,OAAO,CAACC,IAAI,CAAC,oBAAoBzD,OAAO,CAAC0D,IAAI,EAAE,CAAC;MAClD;MACA/D,GAAG,CAACiB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAMoD,MAAM,GAAGA,CAAChE,GAAmB,EAAEiE,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAAC9D,OAAO,CAAEE,OAAO,IAAK;IAC5BN,IAAI,CAACC,GAAG,EAAEK,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
2
2
|
import type { BaseRecorder, JsiRecorder, Skia } from "../../skia/types";
|
3
|
-
import type { PaintProps, NodeType, BlurMaskFilterProps, CTMProps, BoxProps, BoxShadowProps, ImageProps, CircleProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps } from "../../dom/types";
|
3
|
+
import type { PaintProps, NodeType, BlurMaskFilterProps, CTMProps, BoxProps, BoxShadowProps, ImageProps, CircleProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, SkottieProps } from "../../dom/types";
|
4
4
|
import type { AnimatedProps } from "../../renderer";
|
5
5
|
export declare class ReanimatedRecorder implements BaseRecorder {
|
6
6
|
private values;
|
@@ -50,4 +50,5 @@ export declare class ReanimatedRecorder implements BaseRecorder {
|
|
50
50
|
drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
|
51
51
|
drawParagraph(props: AnimatedProps<ParagraphProps>): void;
|
52
52
|
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
53
|
+
drawSkottie(props: AnimatedProps<SkottieProps>): void;
|
53
54
|
}
|
@@ -178,5 +178,9 @@ export class ReanimatedRecorder {
|
|
178
178
|
this.processAnimationValues(props);
|
179
179
|
this.recorder.drawAtlas(props);
|
180
180
|
}
|
181
|
+
drawSkottie(props) {
|
182
|
+
this.processAnimationValues(props);
|
183
|
+
this.recorder.drawSkottie(props);
|
184
|
+
}
|
181
185
|
}
|
182
186
|
//# sourceMappingURL=ReanimatedRecorder.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","processAnimationValues","props","Object","values","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n}\n"],"mappings":";;;AA+BA,SAASA,aAAa,QAAQ,UAAU;AAExC,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAI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AC9C,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACyD,QAAQ,CAACtD,KAAK,CAAC;EAC/B;EAEAuD,YAAYA,CAACvD,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC0D,YAAY,CAACvD,KAAK,CAAC;EACnC;EAEAwD,YAAYA,CAACxD,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC2D,YAAY,CAACxD,KAAK,CAAC;EACnC;EAEAyD,UAAUA,CAACzD,KAAiC,EAAQ;IAClD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC4D,UAAU,CAACzD,KAAK,CAAC;EACjC;EAEA0D,WAAWA,CAAC1D,KAAkC,EAAQ;IACpD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC6D,WAAW,CAAC1D,KAAK,CAAC;EAClC;EAEA2D,YAAYA,CAAC3D,KAAmC,EAAQ;IACtD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC8D,YAAY,CAAC3D,KAAK,CAAC;EACnC;EAEA4D,aAAaA,CAAC5D,KAAoC,EAAQ;IACxD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAAC+D,aAAa,CAAC5D,KAAK,CAAC;EACpC;EAEA6D,SAASA,CAAC7D,KAAgC,EAAQ;IAChD,IAAI,CAACD,sBAAsB,CAACC,KAAK,CAAC;IAClC,IAAI,CAACH,QAAQ,CAACgE,SAAS,CAAC7D,KAAK,CAAC;EAChC;AACF","ignoreList":[]}
|
1
|
+
{"version":3,"names":["isSharedValue","ReanimatedRecorder","constructor","Skia","_defineProperty","Set","recorder","Recorder","processAnimationValues","props","Object","values","forEach","value","has","name","size","add","getRecorder","getSharedValues","Array","from","saveGroup","restoreGroup","savePaint","standalone","restorePaint","restorePaintDeclaration","materializePaint","pushPathEffect","pathEffectType","pushImageFilter","imageFilterType","pushColorFilter","colorFilterType","pushShader","shaderType","pushBlurMaskFilter","composePathEffect","composeColorFilter","composeImageFilter","saveCTM","restoreCTM","drawPaint","saveLayer","saveBackdropFilter","drawBox","boxProps","shadows","shadow","map","s","drawImage","drawCircle","drawPoints","drawPath","drawRect","drawRRect","drawOval","drawLine","drawPatch","drawVertices","drawDiffRect","drawText","drawTextPath","drawTextBlob","drawGlyphs","drawPicture","drawImageSVG","drawParagraph","drawAtlas","drawSkottie"],"sources":["ReanimatedRecorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type { BaseRecorder, JsiRecorder, Skia } from \"../../skia/types\";\nimport type {\n PaintProps,\n NodeType,\n BlurMaskFilterProps,\n CTMProps,\n BoxProps,\n BoxShadowProps,\n ImageProps,\n CircleProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n SkottieProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\n\nexport class ReanimatedRecorder implements BaseRecorder {\n private values = new Set<SharedValue<unknown>>();\n private recorder: JsiRecorder;\n\n constructor(Skia: Skia) {\n this.recorder = Skia.Recorder();\n }\n\n private processAnimationValues(props?: Record<string, unknown>) {\n if (!props) {\n return;\n }\n Object.values(props).forEach((value) => {\n if (isSharedValue(value) && !this.values.has(value)) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n value.name = `variable${this.values.size}`;\n this.values.add(value as SharedValue<unknown>);\n }\n });\n }\n\n getRecorder() {\n return this.recorder;\n }\n\n getSharedValues() {\n return Array.from(this.values);\n }\n\n saveGroup(): void {\n this.recorder.saveGroup();\n }\n\n restoreGroup(): void {\n this.recorder.restoreGroup();\n }\n\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void {\n this.processAnimationValues(props);\n this.recorder.savePaint(props, standalone);\n }\n\n restorePaint(): void {\n this.recorder.restorePaint();\n }\n\n restorePaintDeclaration(): void {\n this.recorder.restorePaintDeclaration();\n }\n\n materializePaint(): void {\n this.recorder.materializePaint();\n }\n\n pushPathEffect(\n pathEffectType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushPathEffect(pathEffectType, props);\n }\n\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushImageFilter(imageFilterType, props);\n }\n\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void {\n this.processAnimationValues(props);\n this.recorder.pushColorFilter(colorFilterType, props);\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void {\n this.processAnimationValues(props);\n this.recorder.pushShader(shaderType, props);\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void {\n this.processAnimationValues(props);\n this.recorder.pushBlurMaskFilter(props);\n }\n\n composePathEffect(): void {\n this.recorder.composePathEffect();\n }\n\n composeColorFilter(): void {\n this.recorder.composeColorFilter();\n }\n\n composeImageFilter(): void {\n this.recorder.composeImageFilter();\n }\n\n saveCTM(props: AnimatedProps<CTMProps>): void {\n this.processAnimationValues(props);\n this.recorder.saveCTM(props);\n }\n\n restoreCTM(): void {\n this.recorder.restoreCTM();\n }\n\n drawPaint(): void {\n this.recorder.drawPaint();\n }\n\n saveLayer(): void {\n this.recorder.saveLayer();\n }\n\n saveBackdropFilter(): void {\n this.recorder.saveBackdropFilter();\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n }[]\n ): void {\n this.processAnimationValues(boxProps);\n shadows.forEach((shadow) => {\n this.processAnimationValues(\n shadow.props as AnimatedProps<BoxShadowProps>\n );\n });\n this.recorder.drawBox(\n boxProps,\n // TODO: Fix this type BaseRecorder.drawBox()\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-expect-error\n shadows.map((s) => s.props)\n );\n }\n\n drawImage(props: AnimatedProps<ImageProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImage(props);\n }\n\n drawCircle(props: AnimatedProps<CircleProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawCircle(props);\n }\n\n drawPoints(props: AnimatedProps<PointsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPoints(props);\n }\n\n drawPath(props: AnimatedProps<PathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPath(props);\n }\n\n drawRect(props: AnimatedProps<RectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRect(props);\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawRRect(props);\n }\n\n drawOval(props: AnimatedProps<OvalProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawOval(props);\n }\n\n drawLine(props: AnimatedProps<LineProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawLine(props);\n }\n\n drawPatch(props: AnimatedProps<PatchProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPatch(props);\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawVertices(props);\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawDiffRect(props);\n }\n\n drawText(props: AnimatedProps<TextProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawText(props);\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextPath(props);\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawTextBlob(props);\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawGlyphs(props);\n }\n\n drawPicture(props: AnimatedProps<PictureProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawPicture(props);\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawImageSVG(props);\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawParagraph(props);\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawAtlas(props);\n }\n\n drawSkottie(props: AnimatedProps<SkottieProps>): void {\n this.processAnimationValues(props);\n this.recorder.drawSkottie(props);\n }\n}\n"],"mappings":";;;AAgCA,SAASA,aAAa,QAAQ,UAAU;AAExC,OAAO,MAAMC,kBAAkB,CAAyB;EAItDC,WAAWA,CAACC,IAAU,EAAE;IAAAC,eAAA,iBAHP,IAAIC,GAAG,CAAuB,CAAC;IAAAD,eAAA;IAI9C,IAAI,CAACE,QAAQ,GAAGH,IAAI,CAACI,QAAQ,CAAC,CAAC;EACjC;EAEQC,sBAAsBA,CAACC,KAA+B,EAAE;IAC9D,IAAI,CAACA,KAAK,EAAE;MACV;IACF;IACAC,MAAM,CAACC,MAAM,CAACF,KAAK,CAAC,CAACG,OAAO,CAAEC,KAAK,IAAK;MACtC,IAAIb,aAAa,CAACa,KAAK,CAAC,IAAI,CAAC,IAAI,CAACF,MAAM,CAACG,GAAG,CAACD,KAAK,CAAC,EAAE;QACnD;QACA;QACAA,KAAK,CAACE,IAAI,GAAG,WAAW,IAAI,CAACJ,MAAM,CAACK,IAAI,EAAE;QAC1C,IAAI,CAACL,MAAM,CAACM,GAAG,CAACJ,KAA6B,CAAC;MAChD;IACF,CAAC,CAAC;EACJ;E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