@shopify/react-native-skia 2.0.7 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +32 -0
- package/cpp/api/recorder/Drawings.h +23 -0
- package/cpp/api/recorder/ImageFilters.h +20 -0
- package/cpp/api/recorder/JsiRecorder.h +6 -0
- package/cpp/api/recorder/RNRecorder.h +15 -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 +8 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +3 -1
- package/lib/commonjs/dom/types/NodeType.js +4 -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/ImageFilter.spec.d.ts +1 -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/ImageFilter.d.ts +4 -0
- package/lib/commonjs/renderer/components/ImageFilter.js +13 -0
- package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -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 +2 -0
- package/lib/commonjs/renderer/components/index.js +22 -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 +3 -1
- package/lib/commonjs/sksg/Elements.js.map +1 -1
- package/lib/commonjs/sksg/Node.d.ts +1 -1
- package/lib/commonjs/sksg/Node.js +1 -1
- package/lib/commonjs/sksg/Node.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 +12 -2
- 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 +8 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +3 -1
- package/lib/module/dom/types/NodeType.js +4 -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/ImageFilter.spec.d.ts +1 -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/ImageFilter.d.ts +4 -0
- package/lib/module/renderer/components/ImageFilter.js +5 -0
- package/lib/module/renderer/components/ImageFilter.js.map +1 -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 +2 -0
- package/lib/module/renderer/components/index.js +2 -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 +3 -1
- package/lib/module/sksg/Elements.js.map +1 -1
- package/lib/module/sksg/Node.d.ts +1 -1
- package/lib/module/sksg/Node.js +1 -1
- package/lib/module/sksg/Node.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 +12 -2
- package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
- package/lib/typescript/lib/commonjs/renderer/components/ImageFilter.d.ts +2 -0
- 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 +8 -0
- package/lib/typescript/lib/module/renderer/components/ImageFilter.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/components/Skottie.d.ts +2 -0
- package/lib/typescript/lib/module/renderer/components/index.d.ts +2 -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 +8 -1
- package/lib/typescript/src/dom/types/NodeType.d.ts +3 -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/ImageFilter.spec.d.ts +1 -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/ImageFilter.d.ts +4 -0
- package/lib/typescript/src/renderer/components/Skottie.d.ts +4 -0
- package/lib/typescript/src/renderer/components/index.d.ts +2 -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 +3 -1
- package/lib/typescript/src/sksg/Node.d.ts +1 -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 +11 -0
- package/src/dom/types/NodeType.ts +4 -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/ImageFilter.spec.tsx +99 -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 +31 -0
- package/src/renderer/components/ImageFilter.tsx +8 -0
- package/src/renderer/components/Skottie.tsx +8 -0
- package/src/renderer/components/index.ts +2 -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 +4 -0
- package/src/sksg/Node.ts +1 -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 +15 -2
@@ -1,7 +1,7 @@
|
|
1
1
|
type Point = { x: number; y: number };
|
2
2
|
type Vec2 = readonly [number, number];
|
3
|
-
type Vec3 = readonly [number, number, number];
|
4
|
-
type Vec4 = readonly [number, number, number, number];
|
3
|
+
export type Vec3 = readonly [number, number, number];
|
4
|
+
export type Vec4 = readonly [number, number, number, number];
|
5
5
|
|
6
6
|
export type Matrix3 = readonly [
|
7
7
|
number,
|
@@ -471,3 +471,109 @@ export const invert4 = (m: Matrix4): Matrix4 => {
|
|
471
471
|
b33 * invDet,
|
472
472
|
] as Matrix4;
|
473
473
|
};
|
474
|
+
|
475
|
+
const vecSub = (a: Vec3, b: Vec3): Vec3 => {
|
476
|
+
"worklet";
|
477
|
+
return [a[0] - b[0], a[1] - b[1], a[2] - b[2]];
|
478
|
+
};
|
479
|
+
|
480
|
+
const vecCross = (a: Vec3, b: Vec3): Vec3 => {
|
481
|
+
"worklet";
|
482
|
+
return [
|
483
|
+
a[1] * b[2] - a[2] * b[1],
|
484
|
+
a[2] * b[0] - a[0] * b[2],
|
485
|
+
a[0] * b[1] - a[1] * b[0],
|
486
|
+
];
|
487
|
+
};
|
488
|
+
|
489
|
+
const lookat = (eyeVec: Vec3, centerVec: Vec3, upVec: Vec3): Matrix4 => {
|
490
|
+
"worklet";
|
491
|
+
const f = normalizeVec(vecSub(centerVec, eyeVec));
|
492
|
+
const u = normalizeVec(upVec);
|
493
|
+
const s = normalizeVec(vecCross(f, u));
|
494
|
+
const uf = vecCross(s, f);
|
495
|
+
|
496
|
+
// Build the look-at matrix directly
|
497
|
+
const m: Matrix4 = [
|
498
|
+
s[0],
|
499
|
+
uf[0],
|
500
|
+
-f[0],
|
501
|
+
eyeVec[0],
|
502
|
+
s[1],
|
503
|
+
uf[1],
|
504
|
+
-f[1],
|
505
|
+
eyeVec[1],
|
506
|
+
s[2],
|
507
|
+
uf[2],
|
508
|
+
-f[2],
|
509
|
+
eyeVec[2],
|
510
|
+
0,
|
511
|
+
0,
|
512
|
+
0,
|
513
|
+
1,
|
514
|
+
];
|
515
|
+
|
516
|
+
return invert4(m);
|
517
|
+
};
|
518
|
+
|
519
|
+
const perspectiveMatrix = (
|
520
|
+
near: number,
|
521
|
+
far: number,
|
522
|
+
angle: number
|
523
|
+
): Matrix4 => {
|
524
|
+
"worklet";
|
525
|
+
const dInv = 1 / (far - near);
|
526
|
+
const halfAngle = angle / 2;
|
527
|
+
const cot = Math.cos(halfAngle) / Math.sin(halfAngle);
|
528
|
+
return [
|
529
|
+
cot,
|
530
|
+
0,
|
531
|
+
0,
|
532
|
+
0,
|
533
|
+
0,
|
534
|
+
cot,
|
535
|
+
0,
|
536
|
+
0,
|
537
|
+
0,
|
538
|
+
0,
|
539
|
+
(far + near) * dInv,
|
540
|
+
2 * far * near * dInv,
|
541
|
+
0,
|
542
|
+
0,
|
543
|
+
-1,
|
544
|
+
1,
|
545
|
+
];
|
546
|
+
};
|
547
|
+
|
548
|
+
export interface CameraConfig {
|
549
|
+
eye: Vec3;
|
550
|
+
coa: Vec3;
|
551
|
+
up: Vec3;
|
552
|
+
near: number;
|
553
|
+
far: number;
|
554
|
+
angle: number;
|
555
|
+
}
|
556
|
+
|
557
|
+
export const setupCamera = (
|
558
|
+
area: Vec4,
|
559
|
+
zscale: number,
|
560
|
+
cam: CameraConfig
|
561
|
+
): Matrix4 => {
|
562
|
+
"worklet";
|
563
|
+
const camera = lookat(cam.eye, cam.coa, cam.up);
|
564
|
+
const p = perspectiveMatrix(cam.near, cam.far, cam.angle);
|
565
|
+
const center: Vec3 = [(area[0] + area[2]) / 2, (area[1] + area[3]) / 2, 0];
|
566
|
+
const viewScale: Vec3 = [
|
567
|
+
(area[2] - area[0]) / 2,
|
568
|
+
(area[3] - area[1]) / 2,
|
569
|
+
zscale,
|
570
|
+
];
|
571
|
+
const viewport = multiply4(
|
572
|
+
translate(center[0], center[1], center[2]),
|
573
|
+
scale(viewScale[0], viewScale[1], viewScale[2])
|
574
|
+
);
|
575
|
+
return multiply4(
|
576
|
+
multiply4(viewport, p),
|
577
|
+
multiply4(camera, invert4(viewport))
|
578
|
+
);
|
579
|
+
};
|
@@ -26,6 +26,7 @@ import type {
|
|
26
26
|
TextBlobProps,
|
27
27
|
TextPathProps,
|
28
28
|
VerticesProps,
|
29
|
+
SkottieProps,
|
29
30
|
} from "../../dom/types";
|
30
31
|
import type { AnimatedProps } from "../../renderer/processors/Animations/Animations";
|
31
32
|
|
@@ -82,6 +83,7 @@ export interface BaseRecorder {
|
|
82
83
|
drawPicture(props: AnimatedProps<PictureProps>): void;
|
83
84
|
drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
|
84
85
|
drawParagraph(props: AnimatedProps<ParagraphProps>): void;
|
86
|
+
drawSkottie(props: AnimatedProps<SkottieProps>): void;
|
85
87
|
drawAtlas(props: AnimatedProps<AtlasProps>): void;
|
86
88
|
}
|
87
89
|
|
package/src/skia/types/Skia.ts
CHANGED
@@ -33,6 +33,7 @@ import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
|
33
33
|
import type { Video } from "./Video";
|
34
34
|
import type { NativeBufferFactory } from "./NativeBuffer";
|
35
35
|
import type { JsiRecorder } from "./Recorder";
|
36
|
+
import type { SkottieFactory } from "./Skottie";
|
36
37
|
|
37
38
|
export interface SkiaContext {
|
38
39
|
getSurface(): SkSurface;
|
@@ -102,6 +103,7 @@ export interface Skia {
|
|
102
103
|
TextBlob: TextBlobFactory;
|
103
104
|
Surface: SurfaceFactory;
|
104
105
|
ParagraphBuilder: ParagraphBuilderFactory;
|
106
|
+
Skottie: SkottieFactory;
|
105
107
|
Video: (url: string) => Promise<Video> | Video;
|
106
108
|
Context(surface: bigint, width: number, height: number): SkiaContext;
|
107
109
|
NativeBuffer: NativeBufferFactory;
|
@@ -0,0 +1,266 @@
|
|
1
|
+
import type { SkCanvas } from "./Canvas";
|
2
|
+
import type { SkColor } from "./Color";
|
3
|
+
import type { SkData } from "./Data";
|
4
|
+
import type { SkJSIInstance } from "./JsiInstance";
|
5
|
+
import type { StrokeJoin } from "./Paint";
|
6
|
+
import type { TextAlign, TextDirection } from "./Paragraph";
|
7
|
+
import type { SkPoint } from "./Point";
|
8
|
+
import type { SkRect } from "./Rect";
|
9
|
+
import type { SkSize } from "./Size";
|
10
|
+
import type { SkTypeface } from "./Typeface";
|
11
|
+
|
12
|
+
export enum LineBreakType {
|
13
|
+
SoftLineBreak,
|
14
|
+
HardtLineBreak,
|
15
|
+
}
|
16
|
+
|
17
|
+
export enum VerticalTextAlign {
|
18
|
+
Top,
|
19
|
+
TopBaseline,
|
20
|
+
// Skottie vertical alignment extensions
|
21
|
+
// Visual alignement modes -- these are using tight visual bounds for the paragraph.
|
22
|
+
VisualTop, // visual top -> text box top
|
23
|
+
VisualCenter, // visual center -> text box center
|
24
|
+
VisualBottom, // visual bottom -> text box bottom
|
25
|
+
}
|
26
|
+
|
27
|
+
export enum ResizePolicy {
|
28
|
+
// Use the specified text size.
|
29
|
+
None,
|
30
|
+
// Resize the text such that the extent box fits (snuggly) in the text box,
|
31
|
+
// both horizontally and vertically.
|
32
|
+
ScaleToFit,
|
33
|
+
// Same kScaleToFit if the text doesn't fit at the specified font size.
|
34
|
+
// Otherwise, same as kNone.
|
35
|
+
DownscaleToFit,
|
36
|
+
}
|
37
|
+
|
38
|
+
export enum InputState {
|
39
|
+
Down,
|
40
|
+
Up,
|
41
|
+
Move,
|
42
|
+
Right,
|
43
|
+
Left,
|
44
|
+
}
|
45
|
+
|
46
|
+
export enum ModifierKey {
|
47
|
+
None,
|
48
|
+
Shift,
|
49
|
+
Control,
|
50
|
+
Option,
|
51
|
+
Command,
|
52
|
+
FirstPress,
|
53
|
+
}
|
54
|
+
|
55
|
+
export interface AnimationMarker {
|
56
|
+
name: string;
|
57
|
+
t0: number; // 0.0 to 1.0
|
58
|
+
t1: number; // 0.0 to 1.0
|
59
|
+
}
|
60
|
+
|
61
|
+
export interface ColorProperty {
|
62
|
+
/**
|
63
|
+
* Property identifier, usually the node name.
|
64
|
+
*/
|
65
|
+
key: string;
|
66
|
+
/**
|
67
|
+
* Property value (RGBA, 255-based).
|
68
|
+
*/
|
69
|
+
value: SkColor;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Named opacity property.
|
74
|
+
*/
|
75
|
+
export interface OpacityProperty {
|
76
|
+
/**
|
77
|
+
* Property identifier, usually the node name.
|
78
|
+
*/
|
79
|
+
key: string;
|
80
|
+
/**
|
81
|
+
* Property value (0..100).
|
82
|
+
*/
|
83
|
+
value: number;
|
84
|
+
}
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Text property value.
|
88
|
+
*/
|
89
|
+
export interface TextValue {
|
90
|
+
/**
|
91
|
+
* The text string payload.
|
92
|
+
*/
|
93
|
+
text: string;
|
94
|
+
/**
|
95
|
+
* Font size.
|
96
|
+
*/
|
97
|
+
size: number;
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Named text property.
|
102
|
+
*/
|
103
|
+
export interface TextProperty {
|
104
|
+
/**
|
105
|
+
* Property identifier, usually the node name.
|
106
|
+
*/
|
107
|
+
key: string;
|
108
|
+
/**
|
109
|
+
* Property value.
|
110
|
+
*/
|
111
|
+
value: TextValue;
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Transform property value. Maps to AE styled transform.
|
116
|
+
*/
|
117
|
+
export interface TransformValue {
|
118
|
+
/**
|
119
|
+
* Anchor point for transform. x and y value.
|
120
|
+
*/
|
121
|
+
anchor: SkPoint;
|
122
|
+
/**
|
123
|
+
* Position of transform. x and y value.
|
124
|
+
*/
|
125
|
+
position: SkPoint;
|
126
|
+
/**
|
127
|
+
* Scale of transform. x and y value.
|
128
|
+
*/
|
129
|
+
scale: SkPoint;
|
130
|
+
/**
|
131
|
+
* Rotation of transform in degrees.
|
132
|
+
*/
|
133
|
+
rotation: number;
|
134
|
+
/**
|
135
|
+
* Skew to apply during transform.
|
136
|
+
*/
|
137
|
+
skew: number;
|
138
|
+
/**
|
139
|
+
* Direction of skew in degrees.
|
140
|
+
*/
|
141
|
+
skewAxis: number;
|
142
|
+
}
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Named transform property for Skottie property observer.
|
146
|
+
*/
|
147
|
+
export interface TransformProperty {
|
148
|
+
/**
|
149
|
+
* Property identifier, usually the node name.
|
150
|
+
*/
|
151
|
+
key: string;
|
152
|
+
/**
|
153
|
+
* Property value.
|
154
|
+
*/
|
155
|
+
value: TransformValue;
|
156
|
+
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Collection of slot IDs sorted by value type
|
160
|
+
*/
|
161
|
+
export interface SlotInfo {
|
162
|
+
colorSlotIDs: string[];
|
163
|
+
scalarSlotIDs: string[];
|
164
|
+
vec2SlotIDs: string[];
|
165
|
+
imageSlotIDs: string[];
|
166
|
+
textSlotIDs: string[];
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Text property for ManagedAnimation's slot support
|
171
|
+
*/
|
172
|
+
export interface SlottableTextProperty {
|
173
|
+
typeface?: SkTypeface;
|
174
|
+
text?: string;
|
175
|
+
textSize?: number;
|
176
|
+
|
177
|
+
minTextSize?: number;
|
178
|
+
maxTextSize?: number;
|
179
|
+
strokeWidth?: number;
|
180
|
+
lineHeight?: number;
|
181
|
+
lineShift?: number;
|
182
|
+
ascent?: number;
|
183
|
+
maxLines?: number;
|
184
|
+
|
185
|
+
horizAlign?: TextAlign;
|
186
|
+
vertAlign?: VerticalTextAlign;
|
187
|
+
strokeJoin?: StrokeJoin;
|
188
|
+
direction?: TextDirection;
|
189
|
+
linebreak?: LineBreakType;
|
190
|
+
resize?: ResizePolicy;
|
191
|
+
|
192
|
+
boundingBox?: SkRect;
|
193
|
+
fillColor?: SkColor;
|
194
|
+
strokeColor?: SkColor;
|
195
|
+
}
|
196
|
+
|
197
|
+
export interface SkSkottieAnimation extends SkJSIInstance<"SkottieAnimation"> {
|
198
|
+
/**
|
199
|
+
* Returns the animation duration in seconds.
|
200
|
+
*/
|
201
|
+
duration(): number;
|
202
|
+
/**
|
203
|
+
* Returns the animation frame rate (frames / second).
|
204
|
+
*/
|
205
|
+
fps(): number;
|
206
|
+
|
207
|
+
/**
|
208
|
+
* Draws current animation frame. Must call seek or seekFrame first.
|
209
|
+
* @param canvas
|
210
|
+
* @param dstRect
|
211
|
+
*/
|
212
|
+
render(canvas: SkCanvas, dstRect?: SkRect): void;
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Update the animation state to match |t|, specified as a frame index
|
216
|
+
* i.e. relative to duration() * fps().
|
217
|
+
*
|
218
|
+
* Returns the rectangle that was affected by this animation.
|
219
|
+
*
|
220
|
+
* @param frame - Fractional values are allowed and meaningful - e.g.
|
221
|
+
* 0.0 -> first frame
|
222
|
+
* 1.0 -> second frame
|
223
|
+
* 0.5 -> halfway between first and second frame
|
224
|
+
* @param damageRect - will copy damage frame into this if provided.
|
225
|
+
*/
|
226
|
+
seekFrame(frame: number, damageRect?: SkRect): void;
|
227
|
+
|
228
|
+
size(): SkSize;
|
229
|
+
|
230
|
+
version(): string;
|
231
|
+
|
232
|
+
getSlotInfo(): SlotInfo;
|
233
|
+
|
234
|
+
setColorSlot(key: string, color: SkColor): boolean;
|
235
|
+
setScalarSlot(key: string, scalar: number): boolean;
|
236
|
+
setVec2Slot(key: string, vec2: SkPoint): boolean;
|
237
|
+
setTextSlot(key: string, text: SlottableTextProperty): boolean;
|
238
|
+
setImageSlot(key: string, assetName: string): boolean;
|
239
|
+
|
240
|
+
getColorSlot(key: string): SkColor | null;
|
241
|
+
getScalarSlot(key: string): number | null;
|
242
|
+
getVec2Slot(key: string): SkPoint | null;
|
243
|
+
getTextSlot(key: string): SlottableTextProperty | null;
|
244
|
+
|
245
|
+
getColorProps(): ColorProperty[];
|
246
|
+
getTextProps(): TextProperty[];
|
247
|
+
getOpacityProps(): OpacityProperty[];
|
248
|
+
getTransformProps(): TransformProperty[];
|
249
|
+
|
250
|
+
setColor(key: string, color: SkColor): boolean;
|
251
|
+
setText(key: string, text: string, size: number): boolean;
|
252
|
+
setOpacity(key: string, opacity: number): boolean;
|
253
|
+
setTransform(
|
254
|
+
key: string,
|
255
|
+
anchor: SkPoint,
|
256
|
+
position: SkPoint,
|
257
|
+
scale: SkPoint,
|
258
|
+
rotation: number,
|
259
|
+
skew: number,
|
260
|
+
skewAxis: number
|
261
|
+
): boolean;
|
262
|
+
}
|
263
|
+
|
264
|
+
export interface SkottieFactory {
|
265
|
+
Make(json: string, assets?: Record<string, SkData>): SkSkottieAnimation;
|
266
|
+
}
|
package/src/skia/types/index.ts
CHANGED