@shopify/react-native-skia 0.1.229 → 0.1.230
Sign up to get free protection for your applications and to get access to all the features.
- package/android/cpp/jni/JniLoad.cpp +0 -2
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaModule.java +0 -1
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +7 -12
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +1 -1
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureView.java +1 -1
- package/cpp/api/JsiSkApi.h +4 -1
- package/cpp/api/JsiSkParagraph.h +15 -0
- package/cpp/api/JsiSkParagraphBuilder.h +3 -32
- package/cpp/api/JsiSkParagraphBuilderFactory.h +54 -0
- package/cpp/rnskia/RNSkJsiViewApi.h +0 -52
- package/cpp/rnskia/RNSkManager.cpp +0 -6
- package/cpp/rnskia/RNSkView.h +2 -91
- package/cpp/rnskia/dom/JsiDomApi.h +0 -9
- package/lib/commonjs/animation/index.d.ts +0 -3
- package/lib/commonjs/animation/index.js +0 -39
- package/lib/commonjs/animation/index.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +0 -6
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +0 -3
- package/lib/commonjs/dom/nodes/Node.js +0 -5
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/commonjs/dom/nodes/drawings/index.js +0 -13
- package/lib/commonjs/dom/nodes/drawings/index.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +0 -4
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +0 -1
- package/lib/commonjs/dom/types/NodeType.js +0 -1
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +1 -2
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/index.d.ts +0 -1
- package/lib/commonjs/index.js +0 -14
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -4
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +2 -21
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.d.ts +1 -3
- package/lib/commonjs/renderer/Container.js +4 -6
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +1 -6
- package/lib/commonjs/renderer/HostComponents.js +0 -3
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +2 -23
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +1 -5
- package/lib/commonjs/renderer/Reconciler.js +3 -18
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/renderer/components/index.d.ts +0 -1
- package/lib/commonjs/renderer/components/index.js +0 -13
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/index.d.ts +0 -1
- package/lib/commonjs/renderer/index.js +0 -13
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/commonjs/renderer/processors/Animations/Animations.js +0 -44
- package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/commonjs/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/commonjs/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js +12 -0
- package/lib/commonjs/skia/web/JsiSkParagraph.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js +5 -2
- package/lib/commonjs/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/commonjs/views/SkiaBaseWebView.js +0 -17
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +0 -7
- package/lib/commonjs/views/SkiaDomView.js +3 -14
- package/lib/commonjs/views/SkiaDomView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +4 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.d.ts +0 -7
- package/lib/commonjs/views/SkiaPictureView.js +3 -14
- package/lib/commonjs/views/SkiaPictureView.js.map +1 -1
- package/lib/commonjs/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/commonjs/views/SkiaViewNativeId.js +11 -0
- package/lib/commonjs/views/SkiaViewNativeId.js.map +1 -0
- package/lib/commonjs/views/index.d.ts +0 -2
- package/lib/commonjs/views/index.js +0 -26
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +2 -15
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/animation/index.d.ts +0 -3
- package/lib/module/animation/index.js +0 -3
- package/lib/module/animation/index.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/module/dom/nodes/JsiSkDOM.js +1 -7
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +0 -3
- package/lib/module/dom/nodes/Node.js +0 -5
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/module/dom/nodes/drawings/index.js +0 -1
- package/lib/module/dom/nodes/drawings/index.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +0 -4
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +0 -1
- package/lib/module/dom/types/NodeType.js +0 -1
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +1 -2
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/index.d.ts +0 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mock/index.js +1 -4
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +2 -20
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.d.ts +1 -3
- package/lib/module/renderer/Container.js +4 -6
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +1 -6
- package/lib/module/renderer/HostComponents.js +0 -3
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +3 -23
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Reconciler.d.ts +1 -5
- package/lib/module/renderer/Reconciler.js +3 -16
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/renderer/components/index.d.ts +0 -1
- package/lib/module/renderer/components/index.js +0 -1
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/index.d.ts +0 -1
- package/lib/module/renderer/index.js +0 -1
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/module/renderer/processors/Animations/Animations.js +0 -28
- package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
- package/lib/module/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/module/skia/types/Paragraph/Paragraph.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/module/skia/web/JsiSkParagraph.js +12 -0
- package/lib/module/skia/web/JsiSkParagraph.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +5 -2
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/module/views/SkiaBaseWebView.js +0 -17
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.d.ts +0 -7
- package/lib/module/views/SkiaDomView.js +2 -13
- package/lib/module/views/SkiaDomView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +4 -13
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.d.ts +0 -7
- package/lib/module/views/SkiaPictureView.js +2 -13
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/module/views/SkiaViewNativeId.js +4 -0
- package/lib/module/views/SkiaViewNativeId.js.map +1 -0
- package/lib/module/views/index.d.ts +0 -2
- package/lib/module/views/index.js +0 -2
- package/lib/module/views/index.js.map +1 -1
- package/lib/module/views/types.d.ts +2 -15
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/animation/index.d.ts +0 -3
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +1 -2
- package/lib/typescript/src/dom/nodes/Node.d.ts +0 -3
- package/lib/typescript/src/dom/nodes/drawings/index.d.ts +0 -1
- package/lib/typescript/src/dom/types/Drawings.d.ts +0 -4
- package/lib/typescript/src/dom/types/NodeType.d.ts +0 -1
- package/lib/typescript/src/dom/types/SkDOM.d.ts +1 -2
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/renderer/Container.d.ts +1 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +1 -6
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -5
- package/lib/typescript/src/renderer/components/index.d.ts +0 -1
- package/lib/typescript/src/renderer/index.d.ts +0 -1
- package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +1 -8
- package/lib/typescript/src/skia/types/Paragraph/Paragraph.d.ts +23 -0
- package/lib/typescript/src/skia/web/JsiSkParagraph.d.ts +3 -0
- package/lib/typescript/src/views/SkiaBaseWebView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaDomView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaPictureView.d.ts +0 -7
- package/lib/typescript/src/views/SkiaViewNativeId.d.ts +3 -0
- package/lib/typescript/src/views/index.d.ts +0 -2
- package/lib/typescript/src/views/types.d.ts +2 -15
- package/package.json +1 -1
- package/src/animation/index.ts +0 -3
- package/src/dom/nodes/JsiSkDOM.ts +0 -12
- package/src/dom/nodes/Node.ts +0 -5
- package/src/dom/nodes/drawings/index.ts +0 -1
- package/src/dom/types/Drawings.ts +0 -5
- package/src/dom/types/NodeType.ts +0 -1
- package/src/dom/types/SkDOM.ts +0 -4
- package/src/index.ts +0 -1
- package/src/mock/index.ts +0 -3
- package/src/renderer/Canvas.tsx +3 -21
- package/src/renderer/Container.tsx +1 -4
- package/src/renderer/HostComponents.ts +0 -13
- package/src/renderer/HostConfig.ts +3 -24
- package/src/renderer/Reconciler.tsx +1 -19
- package/src/renderer/components/index.ts +0 -1
- package/src/renderer/index.ts +0 -1
- package/src/renderer/processors/Animations/Animations.ts +1 -51
- package/src/skia/types/Paragraph/Paragraph.ts +25 -0
- package/src/skia/web/JsiSkParagraph.ts +11 -0
- package/src/skia/web/JsiSkParagraphBuilderFactory.ts +9 -3
- package/src/views/SkiaBaseWebView.tsx +0 -19
- package/src/views/SkiaDomView.tsx +1 -13
- package/src/views/SkiaDomView.web.tsx +1 -6
- package/src/views/SkiaPictureView.tsx +1 -13
- package/src/views/SkiaViewNativeId.ts +1 -0
- package/src/views/index.ts +0 -2
- package/src/views/types.ts +2 -26
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawView.java +0 -44
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDrawViewManager.java +0 -34
- package/cpp/rnskia/RNSkAnimation.h +0 -65
- package/cpp/rnskia/RNSkValueApi.h +0 -72
- package/cpp/rnskia/dom/base/JsiDependencyManager.h +0 -297
- package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +0 -127
- package/cpp/rnskia/dom/props/DrawingProp.h +0 -35
- package/cpp/rnskia/values/RNSkClockValue.h +0 -140
- package/cpp/rnskia/values/RNSkComputedValue.h +0 -104
- package/cpp/rnskia/values/RNSkReadonlyValue.h +0 -166
- package/cpp/rnskia/values/RNSkValue.h +0 -116
- package/ios/RNSkia-iOS/SkiaDrawView.h +0 -7
- package/ios/RNSkia-iOS/SkiaDrawView.mm +0 -72
- package/ios/RNSkia-iOS/SkiaDrawViewManager.h +0 -7
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +0 -50
- package/lib/commonjs/animation/decay/decay.d.ts +0 -2
- package/lib/commonjs/animation/decay/decay.js +0 -42
- package/lib/commonjs/animation/decay/decay.js.map +0 -1
- package/lib/commonjs/animation/decay/index.d.ts +0 -1
- package/lib/commonjs/animation/decay/index.js +0 -14
- package/lib/commonjs/animation/decay/index.js.map +0 -1
- package/lib/commonjs/animation/decay/runDecay.d.ts +0 -10
- package/lib/commonjs/animation/decay/runDecay.js +0 -48
- package/lib/commonjs/animation/decay/runDecay.js.map +0 -1
- package/lib/commonjs/animation/decay/types.d.ts +0 -21
- package/lib/commonjs/animation/decay/types.js +0 -6
- package/lib/commonjs/animation/decay/types.js.map +0 -1
- package/lib/commonjs/animation/spring/Spring.d.ts +0 -65
- package/lib/commonjs/animation/spring/Spring.js +0 -77
- package/lib/commonjs/animation/spring/Spring.js.map +0 -1
- package/lib/commonjs/animation/spring/functions/index.d.ts +0 -1
- package/lib/commonjs/animation/spring/functions/index.js +0 -14
- package/lib/commonjs/animation/spring/functions/index.js.map +0 -1
- package/lib/commonjs/animation/spring/functions/spring.d.ts +0 -10
- package/lib/commonjs/animation/spring/functions/spring.js +0 -94
- package/lib/commonjs/animation/spring/functions/spring.js.map +0 -1
- package/lib/commonjs/animation/spring/index.d.ts +0 -3
- package/lib/commonjs/animation/spring/index.js +0 -30
- package/lib/commonjs/animation/spring/index.js.map +0 -1
- package/lib/commonjs/animation/spring/runSpring.d.ts +0 -19
- package/lib/commonjs/animation/spring/runSpring.js +0 -35
- package/lib/commonjs/animation/spring/runSpring.js.map +0 -1
- package/lib/commonjs/animation/spring/types.d.ts +0 -6
- package/lib/commonjs/animation/spring/types.js +0 -2
- package/lib/commonjs/animation/spring/types.js.map +0 -1
- package/lib/commonjs/animation/spring/useSpring.d.ts +0 -13
- package/lib/commonjs/animation/spring/useSpring.js +0 -27
- package/lib/commonjs/animation/spring/useSpring.js.map +0 -1
- package/lib/commonjs/animation/timing/Easing.d.ts +0 -19
- package/lib/commonjs/animation/timing/Easing.js +0 -108
- package/lib/commonjs/animation/timing/Easing.js.map +0 -1
- package/lib/commonjs/animation/timing/createTiming.d.ts +0 -17
- package/lib/commonjs/animation/timing/createTiming.js +0 -55
- package/lib/commonjs/animation/timing/createTiming.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/commonjs/animation/timing/functions/bezier.js +0 -147
- package/lib/commonjs/animation/timing/functions/bezier.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js +0 -52
- package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/index.d.ts +0 -4
- package/lib/commonjs/animation/timing/functions/index.js +0 -54
- package/lib/commonjs/animation/timing/functions/index.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/timing.d.ts +0 -17
- package/lib/commonjs/animation/timing/functions/timing.js +0 -50
- package/lib/commonjs/animation/timing/functions/timing.js.map +0 -1
- package/lib/commonjs/animation/timing/functions/types.d.ts +0 -7
- package/lib/commonjs/animation/timing/functions/types.js +0 -2
- package/lib/commonjs/animation/timing/functions/types.js.map +0 -1
- package/lib/commonjs/animation/timing/index.d.ts +0 -4
- package/lib/commonjs/animation/timing/index.js +0 -38
- package/lib/commonjs/animation/timing/index.js.map +0 -1
- package/lib/commonjs/animation/timing/runTiming.d.ts +0 -19
- package/lib/commonjs/animation/timing/runTiming.js +0 -36
- package/lib/commonjs/animation/timing/runTiming.js.map +0 -1
- package/lib/commonjs/animation/timing/useLoop.d.ts +0 -11
- package/lib/commonjs/animation/timing/useLoop.js +0 -25
- package/lib/commonjs/animation/timing/useLoop.js.map +0 -1
- package/lib/commonjs/animation/timing/useTiming.d.ts +0 -13
- package/lib/commonjs/animation/timing/useTiming.js +0 -67
- package/lib/commonjs/animation/timing/useTiming.js.map +0 -1
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js +0 -28
- package/lib/commonjs/dom/nodes/drawings/CustomDrawingNode.js.map +0 -1
- package/lib/commonjs/renderer/DependencyManager.d.ts +0 -46
- package/lib/commonjs/renderer/DependencyManager.js +0 -185
- package/lib/commonjs/renderer/DependencyManager.js.map +0 -1
- package/lib/commonjs/renderer/components/Drawing.d.ts +0 -8
- package/lib/commonjs/renderer/components/Drawing.js +0 -22
- package/lib/commonjs/renderer/components/Drawing.js.map +0 -1
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js +0 -16
- package/lib/commonjs/specs/SkiaDrawViewNativeComponent.js.map +0 -1
- package/lib/commonjs/values/api.d.ts +0 -26
- package/lib/commonjs/values/api.js +0 -55
- package/lib/commonjs/values/api.js.map +0 -1
- package/lib/commonjs/values/api.web.d.ts +0 -2
- package/lib/commonjs/values/api.web.js +0 -18
- package/lib/commonjs/values/api.web.js.map +0 -1
- package/lib/commonjs/values/hooks/index.d.ts +0 -4
- package/lib/commonjs/values/hooks/index.js +0 -58
- package/lib/commonjs/values/hooks/index.js.map +0 -1
- package/lib/commonjs/values/hooks/useClockValue.d.ts +0 -9
- package/lib/commonjs/values/hooks/useClockValue.js +0 -30
- package/lib/commonjs/values/hooks/useClockValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/commonjs/values/hooks/useComputedValue.js +0 -32
- package/lib/commonjs/values/hooks/useComputedValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useValue.d.ts +0 -10
- package/lib/commonjs/values/hooks/useValue.js +0 -26
- package/lib/commonjs/values/hooks/useValue.js.map +0 -1
- package/lib/commonjs/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/commonjs/values/hooks/useValueEffect.js +0 -25
- package/lib/commonjs/values/hooks/useValueEffect.js.map +0 -1
- package/lib/commonjs/values/index.d.ts +0 -4
- package/lib/commonjs/values/index.js +0 -58
- package/lib/commonjs/values/index.js.map +0 -1
- package/lib/commonjs/values/selector.d.ts +0 -14
- package/lib/commonjs/values/selector.js +0 -24
- package/lib/commonjs/values/selector.js.map +0 -1
- package/lib/commonjs/values/types.d.ts +0 -63
- package/lib/commonjs/values/types.js +0 -2
- package/lib/commonjs/values/types.js.map +0 -1
- package/lib/commonjs/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/commonjs/values/web/RNSkAnimation.js +0 -46
- package/lib/commonjs/values/web/RNSkAnimation.js.map +0 -1
- package/lib/commonjs/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/commonjs/values/web/RNSkClockValue.js +0 -75
- package/lib/commonjs/values/web/RNSkClockValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/commonjs/values/web/RNSkComputedValue.js +0 -59
- package/lib/commonjs/values/web/RNSkComputedValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/commonjs/values/web/RNSkReadonlyValue.js +0 -51
- package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +0 -1
- package/lib/commonjs/values/web/RNSkValue.d.ts +0 -14
- package/lib/commonjs/values/web/RNSkValue.js +0 -73
- package/lib/commonjs/values/web/RNSkValue.js.map +0 -1
- package/lib/commonjs/values/web/api.d.ts +0 -2
- package/lib/commonjs/values/web/api.js +0 -31
- package/lib/commonjs/values/web/api.js.map +0 -1
- package/lib/commonjs/values/web/index.d.ts +0 -1
- package/lib/commonjs/values/web/index.js +0 -19
- package/lib/commonjs/values/web/index.js.map +0 -1
- package/lib/commonjs/views/SkiaView.d.ts +0 -35
- package/lib/commonjs/views/SkiaView.js +0 -139
- package/lib/commonjs/views/SkiaView.js.map +0 -1
- package/lib/commonjs/views/SkiaView.web.d.ts +0 -7
- package/lib/commonjs/views/SkiaView.web.js +0 -30
- package/lib/commonjs/views/SkiaView.web.js.map +0 -1
- package/lib/commonjs/views/useDrawCallback.d.ts +0 -8
- package/lib/commonjs/views/useDrawCallback.js +0 -23
- package/lib/commonjs/views/useDrawCallback.js.map +0 -1
- package/lib/module/animation/decay/decay.d.ts +0 -2
- package/lib/module/animation/decay/decay.js +0 -33
- package/lib/module/animation/decay/decay.js.map +0 -1
- package/lib/module/animation/decay/index.d.ts +0 -1
- package/lib/module/animation/decay/index.js +0 -2
- package/lib/module/animation/decay/index.js.map +0 -1
- package/lib/module/animation/decay/runDecay.d.ts +0 -10
- package/lib/module/animation/decay/runDecay.js +0 -38
- package/lib/module/animation/decay/runDecay.js.map +0 -1
- package/lib/module/animation/decay/types.d.ts +0 -21
- package/lib/module/animation/decay/types.js +0 -2
- package/lib/module/animation/decay/types.js.map +0 -1
- package/lib/module/animation/spring/Spring.d.ts +0 -65
- package/lib/module/animation/spring/Spring.js +0 -69
- package/lib/module/animation/spring/Spring.js.map +0 -1
- package/lib/module/animation/spring/functions/index.d.ts +0 -1
- package/lib/module/animation/spring/functions/index.js +0 -2
- package/lib/module/animation/spring/functions/index.js.map +0 -1
- package/lib/module/animation/spring/functions/spring.d.ts +0 -10
- package/lib/module/animation/spring/functions/spring.js +0 -85
- package/lib/module/animation/spring/functions/spring.js.map +0 -1
- package/lib/module/animation/spring/index.d.ts +0 -3
- package/lib/module/animation/spring/index.js +0 -4
- package/lib/module/animation/spring/index.js.map +0 -1
- package/lib/module/animation/spring/runSpring.d.ts +0 -19
- package/lib/module/animation/spring/runSpring.js +0 -24
- package/lib/module/animation/spring/runSpring.js.map +0 -1
- package/lib/module/animation/spring/types.d.ts +0 -6
- package/lib/module/animation/spring/types.js +0 -2
- package/lib/module/animation/spring/types.js.map +0 -1
- package/lib/module/animation/spring/useSpring.d.ts +0 -13
- package/lib/module/animation/spring/useSpring.js +0 -16
- package/lib/module/animation/spring/useSpring.js.map +0 -1
- package/lib/module/animation/timing/Easing.d.ts +0 -19
- package/lib/module/animation/timing/Easing.js +0 -98
- package/lib/module/animation/timing/Easing.js.map +0 -1
- package/lib/module/animation/timing/createTiming.d.ts +0 -17
- package/lib/module/animation/timing/createTiming.js +0 -49
- package/lib/module/animation/timing/createTiming.js.map +0 -1
- package/lib/module/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/module/animation/timing/functions/bezier.js +0 -141
- package/lib/module/animation/timing/functions/bezier.js.map +0 -1
- package/lib/module/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/module/animation/timing/functions/getResolvedParams.js +0 -48
- package/lib/module/animation/timing/functions/getResolvedParams.js.map +0 -1
- package/lib/module/animation/timing/functions/index.d.ts +0 -4
- package/lib/module/animation/timing/functions/index.js +0 -5
- package/lib/module/animation/timing/functions/index.js.map +0 -1
- package/lib/module/animation/timing/functions/timing.d.ts +0 -17
- package/lib/module/animation/timing/functions/timing.js +0 -41
- package/lib/module/animation/timing/functions/timing.js.map +0 -1
- package/lib/module/animation/timing/functions/types.d.ts +0 -7
- package/lib/module/animation/timing/functions/types.js +0 -2
- package/lib/module/animation/timing/functions/types.js.map +0 -1
- package/lib/module/animation/timing/index.d.ts +0 -4
- package/lib/module/animation/timing/index.js +0 -5
- package/lib/module/animation/timing/index.js.map +0 -1
- package/lib/module/animation/timing/runTiming.d.ts +0 -19
- package/lib/module/animation/timing/runTiming.js +0 -26
- package/lib/module/animation/timing/runTiming.js.map +0 -1
- package/lib/module/animation/timing/useLoop.d.ts +0 -11
- package/lib/module/animation/timing/useLoop.js +0 -16
- package/lib/module/animation/timing/useLoop.js.map +0 -1
- package/lib/module/animation/timing/useTiming.d.ts +0 -13
- package/lib/module/animation/timing/useTiming.js +0 -57
- package/lib/module/animation/timing/useTiming.js.map +0 -1
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js +0 -17
- package/lib/module/dom/nodes/drawings/CustomDrawingNode.js.map +0 -1
- package/lib/module/renderer/DependencyManager.d.ts +0 -46
- package/lib/module/renderer/DependencyManager.js +0 -174
- package/lib/module/renderer/DependencyManager.js.map +0 -1
- package/lib/module/renderer/components/Drawing.d.ts +0 -8
- package/lib/module/renderer/components/Drawing.js +0 -11
- package/lib/module/renderer/components/Drawing.js.map +0 -1
- package/lib/module/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/module/specs/SkiaDrawViewNativeComponent.js +0 -4
- package/lib/module/specs/SkiaDrawViewNativeComponent.js.map +0 -1
- package/lib/module/values/api.d.ts +0 -26
- package/lib/module/values/api.js +0 -48
- package/lib/module/values/api.js.map +0 -1
- package/lib/module/values/api.web.d.ts +0 -2
- package/lib/module/values/api.web.js +0 -7
- package/lib/module/values/api.web.js.map +0 -1
- package/lib/module/values/hooks/index.d.ts +0 -4
- package/lib/module/values/hooks/index.js +0 -5
- package/lib/module/values/hooks/index.js.map +0 -1
- package/lib/module/values/hooks/useClockValue.d.ts +0 -9
- package/lib/module/values/hooks/useClockValue.js +0 -20
- package/lib/module/values/hooks/useClockValue.js.map +0 -1
- package/lib/module/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/module/values/hooks/useComputedValue.js +0 -21
- package/lib/module/values/hooks/useComputedValue.js.map +0 -1
- package/lib/module/values/hooks/useValue.d.ts +0 -10
- package/lib/module/values/hooks/useValue.js +0 -16
- package/lib/module/values/hooks/useValue.js.map +0 -1
- package/lib/module/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/module/values/hooks/useValueEffect.js +0 -16
- package/lib/module/values/hooks/useValueEffect.js.map +0 -1
- package/lib/module/values/index.d.ts +0 -4
- package/lib/module/values/index.js +0 -5
- package/lib/module/values/index.js.map +0 -1
- package/lib/module/values/selector.d.ts +0 -14
- package/lib/module/values/selector.js +0 -15
- package/lib/module/values/selector.js.map +0 -1
- package/lib/module/values/types.d.ts +0 -63
- package/lib/module/values/types.js +0 -2
- package/lib/module/values/types.js.map +0 -1
- package/lib/module/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/module/values/web/RNSkAnimation.js +0 -36
- package/lib/module/values/web/RNSkAnimation.js.map +0 -1
- package/lib/module/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/module/values/web/RNSkClockValue.js +0 -65
- package/lib/module/values/web/RNSkClockValue.js.map +0 -1
- package/lib/module/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/module/values/web/RNSkComputedValue.js +0 -49
- package/lib/module/values/web/RNSkComputedValue.js.map +0 -1
- package/lib/module/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/module/values/web/RNSkReadonlyValue.js +0 -42
- package/lib/module/values/web/RNSkReadonlyValue.js.map +0 -1
- package/lib/module/values/web/RNSkValue.d.ts +0 -14
- package/lib/module/values/web/RNSkValue.js +0 -63
- package/lib/module/values/web/RNSkValue.js.map +0 -1
- package/lib/module/values/web/api.d.ts +0 -2
- package/lib/module/values/web/api.js +0 -19
- package/lib/module/values/web/api.js.map +0 -1
- package/lib/module/values/web/index.d.ts +0 -1
- package/lib/module/values/web/index.js +0 -2
- package/lib/module/values/web/index.js.map +0 -1
- package/lib/module/views/SkiaView.d.ts +0 -35
- package/lib/module/views/SkiaView.js +0 -119
- package/lib/module/views/SkiaView.js.map +0 -1
- package/lib/module/views/SkiaView.web.d.ts +0 -7
- package/lib/module/views/SkiaView.web.js +0 -20
- package/lib/module/views/SkiaView.web.js.map +0 -1
- package/lib/module/views/useDrawCallback.d.ts +0 -8
- package/lib/module/views/useDrawCallback.js +0 -14
- package/lib/module/views/useDrawCallback.js.map +0 -1
- package/lib/typescript/src/animation/decay/decay.d.ts +0 -2
- package/lib/typescript/src/animation/decay/index.d.ts +0 -1
- package/lib/typescript/src/animation/decay/runDecay.d.ts +0 -10
- package/lib/typescript/src/animation/decay/types.d.ts +0 -21
- package/lib/typescript/src/animation/spring/Spring.d.ts +0 -65
- package/lib/typescript/src/animation/spring/functions/index.d.ts +0 -1
- package/lib/typescript/src/animation/spring/functions/spring.d.ts +0 -10
- package/lib/typescript/src/animation/spring/index.d.ts +0 -3
- package/lib/typescript/src/animation/spring/runSpring.d.ts +0 -19
- package/lib/typescript/src/animation/spring/types.d.ts +0 -6
- package/lib/typescript/src/animation/spring/useSpring.d.ts +0 -13
- package/lib/typescript/src/animation/timing/Easing.d.ts +0 -19
- package/lib/typescript/src/animation/timing/createTiming.d.ts +0 -17
- package/lib/typescript/src/animation/timing/functions/bezier.d.ts +0 -1
- package/lib/typescript/src/animation/timing/functions/getResolvedParams.d.ts +0 -7
- package/lib/typescript/src/animation/timing/functions/index.d.ts +0 -4
- package/lib/typescript/src/animation/timing/functions/timing.d.ts +0 -17
- package/lib/typescript/src/animation/timing/functions/types.d.ts +0 -7
- package/lib/typescript/src/animation/timing/index.d.ts +0 -4
- package/lib/typescript/src/animation/timing/runTiming.d.ts +0 -19
- package/lib/typescript/src/animation/timing/useLoop.d.ts +0 -11
- package/lib/typescript/src/animation/timing/useTiming.d.ts +0 -13
- package/lib/typescript/src/dom/nodes/drawings/CustomDrawingNode.d.ts +0 -8
- package/lib/typescript/src/renderer/DependencyManager.d.ts +0 -46
- package/lib/typescript/src/renderer/components/Drawing.d.ts +0 -8
- package/lib/typescript/src/specs/SkiaDrawViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/values/api.d.ts +0 -26
- package/lib/typescript/src/values/api.web.d.ts +0 -2
- package/lib/typescript/src/values/hooks/index.d.ts +0 -4
- package/lib/typescript/src/values/hooks/useClockValue.d.ts +0 -9
- package/lib/typescript/src/values/hooks/useComputedValue.d.ts +0 -11
- package/lib/typescript/src/values/hooks/useValue.d.ts +0 -10
- package/lib/typescript/src/values/hooks/useValueEffect.d.ts +0 -10
- package/lib/typescript/src/values/index.d.ts +0 -4
- package/lib/typescript/src/values/selector.d.ts +0 -14
- package/lib/typescript/src/values/types.d.ts +0 -63
- package/lib/typescript/src/values/web/RNSkAnimation.d.ts +0 -9
- package/lib/typescript/src/values/web/RNSkClockValue.d.ts +0 -13
- package/lib/typescript/src/values/web/RNSkComputedValue.d.ts +0 -10
- package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +0 -12
- package/lib/typescript/src/values/web/RNSkValue.d.ts +0 -14
- package/lib/typescript/src/values/web/api.d.ts +0 -2
- package/lib/typescript/src/values/web/index.d.ts +0 -1
- package/lib/typescript/src/views/SkiaView.d.ts +0 -35
- package/lib/typescript/src/views/SkiaView.web.d.ts +0 -7
- package/lib/typescript/src/views/useDrawCallback.d.ts +0 -8
- package/src/animation/decay/decay.ts +0 -35
- package/src/animation/decay/index.ts +0 -1
- package/src/animation/decay/runDecay.ts +0 -40
- package/src/animation/decay/types.ts +0 -24
- package/src/animation/spring/Spring.ts +0 -61
- package/src/animation/spring/functions/index.ts +0 -1
- package/src/animation/spring/functions/spring.ts +0 -86
- package/src/animation/spring/index.ts +0 -3
- package/src/animation/spring/runSpring.ts +0 -40
- package/src/animation/spring/types.ts +0 -6
- package/src/animation/spring/useSpring.ts +0 -31
- package/src/animation/timing/Easing.ts +0 -102
- package/src/animation/timing/createTiming.ts +0 -62
- package/src/animation/timing/functions/bezier.ts +0 -165
- package/src/animation/timing/functions/getResolvedParams.ts +0 -50
- package/src/animation/timing/functions/index.ts +0 -4
- package/src/animation/timing/functions/timing.ts +0 -44
- package/src/animation/timing/functions/types.ts +0 -8
- package/src/animation/timing/index.ts +0 -4
- package/src/animation/timing/runTiming.ts +0 -36
- package/src/animation/timing/useLoop.ts +0 -21
- package/src/animation/timing/useTiming.ts +0 -71
- package/src/dom/nodes/drawings/CustomDrawingNode.ts +0 -21
- package/src/renderer/DependencyManager.tsx +0 -196
- package/src/renderer/components/Drawing.tsx +0 -12
- package/src/specs/SkiaDrawViewNativeComponent.ts +0 -10
- package/src/values/api.ts +0 -61
- package/src/values/api.web.ts +0 -5
- package/src/values/hooks/index.ts +0 -4
- package/src/values/hooks/useClockValue.ts +0 -21
- package/src/values/hooks/useComputedValue.ts +0 -24
- package/src/values/hooks/useValue.ts +0 -17
- package/src/values/hooks/useValueEffect.ts +0 -18
- package/src/values/index.ts +0 -4
- package/src/values/selector.ts +0 -24
- package/src/values/types.ts +0 -73
- package/src/values/web/RNSkAnimation.ts +0 -33
- package/src/values/web/RNSkClockValue.ts +0 -58
- package/src/values/web/RNSkComputedValue.ts +0 -49
- package/src/values/web/RNSkReadonlyValue.ts +0 -38
- package/src/values/web/RNSkValue.ts +0 -57
- package/src/values/web/api.ts +0 -33
- package/src/values/web/index.ts +0 -1
- package/src/views/SkiaView.tsx +0 -111
- package/src/views/SkiaView.web.tsx +0 -22
- package/src/views/useDrawCallback.ts +0 -19
@@ -1,35 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
import type { SkRect } from "../skia/types";
|
3
|
-
import type { SkiaValue } from "../values";
|
4
|
-
import type { SkiaDrawViewProps } from "./types";
|
5
|
-
export declare const SkiaViewNativeId: {
|
6
|
-
current: number;
|
7
|
-
};
|
8
|
-
/**
|
9
|
-
* @deprecated If you are looking to use the Skia imperative API, you can use:
|
10
|
-
* The picture API: https://shopify.github.io/react-native-skia/docs/shapes/pictures/
|
11
|
-
* The offscreen API: https://shopify.github.io/react-native-skia/docs/animations/textures
|
12
|
-
*/
|
13
|
-
export declare class SkiaView extends React.Component<SkiaDrawViewProps> {
|
14
|
-
constructor(props: SkiaDrawViewProps);
|
15
|
-
private _nativeId;
|
16
|
-
get nativeId(): number;
|
17
|
-
componentDidUpdate(prevProps: SkiaDrawViewProps): void;
|
18
|
-
/**
|
19
|
-
* Creates a snapshot from the canvas in the surface
|
20
|
-
* @param rect Rect to use as bounds. Optional.
|
21
|
-
* @returns An Image object.
|
22
|
-
*/
|
23
|
-
makeImageSnapshot(rect?: SkRect): import("../skia/types").SkImage;
|
24
|
-
/**
|
25
|
-
* Sends a redraw request to the native SkiaView.
|
26
|
-
*/
|
27
|
-
redraw(): void;
|
28
|
-
/**
|
29
|
-
* Registers one or move values as a dependant value of the Skia View. The view will
|
30
|
-
* The view will redraw itself when any of the values change.
|
31
|
-
* @param values Values to register
|
32
|
-
*/
|
33
|
-
registerValues(values: SkiaValue<unknown>[]): () => void;
|
34
|
-
render(): React.JSX.Element;
|
35
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import type { SkCanvas } from "../skia/types";
|
2
|
-
import type { SkiaDrawViewProps, TouchInfo } from "./types";
|
3
|
-
import { SkiaBaseWebView } from "./SkiaBaseWebView";
|
4
|
-
export declare class SkiaView extends SkiaBaseWebView<SkiaDrawViewProps> {
|
5
|
-
constructor(props: SkiaDrawViewProps);
|
6
|
-
protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void;
|
7
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { DependencyList } from "react";
|
2
|
-
import type { RNSkiaDrawCallback } from "./types";
|
3
|
-
/**
|
4
|
-
* Creates a memoized callback for the onDraw handler of a Skia component.
|
5
|
-
* @param callback The callback to memoize.
|
6
|
-
* @param deps Dependencies for the callback.
|
7
|
-
* */
|
8
|
-
export declare const useDrawCallback: (callback: RNSkiaDrawCallback, deps?: DependencyList) => RNSkiaDrawCallback;
|
@@ -1,35 +0,0 @@
|
|
1
|
-
import type { DecayState, DefaultDecayConfig } from "./types";
|
2
|
-
|
3
|
-
const VELOCITY_EPS = 1;
|
4
|
-
const SLOPE_FACTOR = 0.1;
|
5
|
-
|
6
|
-
export const decay = (
|
7
|
-
now: number,
|
8
|
-
state: DecayState,
|
9
|
-
config: DefaultDecayConfig
|
10
|
-
): DecayState => {
|
11
|
-
const { lastTimestamp, startTimestamp, initialVelocity, current, velocity } =
|
12
|
-
state;
|
13
|
-
const nextState = { ...state };
|
14
|
-
const deltaTime = Math.min(now - lastTimestamp, 64);
|
15
|
-
const v =
|
16
|
-
velocity *
|
17
|
-
Math.exp(
|
18
|
-
-(1 - config.deceleration) * (now - startTimestamp) * SLOPE_FACTOR
|
19
|
-
);
|
20
|
-
nextState.current = current + (v * config.velocityFactor * deltaTime) / 1000; // /1000 because time is in ms not in s
|
21
|
-
nextState.velocity = v;
|
22
|
-
nextState.lastTimestamp = now;
|
23
|
-
|
24
|
-
if (config.clamp) {
|
25
|
-
if (initialVelocity < 0 && nextState.current <= config.clamp[0]) {
|
26
|
-
nextState.current = config.clamp[0];
|
27
|
-
nextState.finished = true;
|
28
|
-
} else if (initialVelocity > 0 && nextState.current >= config.clamp[1]) {
|
29
|
-
nextState.current = config.clamp[1];
|
30
|
-
nextState.finished = true;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
nextState.finished = Math.abs(v) < VELOCITY_EPS;
|
34
|
-
return nextState;
|
35
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { runDecay } from "./runDecay";
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import { ValueApi } from "../../values/api";
|
2
|
-
import type { SkiaMutableValue } from "../../values/types";
|
3
|
-
|
4
|
-
import { decay } from "./decay";
|
5
|
-
import type { DecayConfig, DefaultDecayConfig, DecayState } from "./types";
|
6
|
-
|
7
|
-
/**
|
8
|
-
* Runs a decay animation from the current value to zero with the given decay
|
9
|
-
* configuration.
|
10
|
-
* @param value value to animate
|
11
|
-
* @param config Configuration or default configuration
|
12
|
-
* @returns Animation
|
13
|
-
*/
|
14
|
-
export const runDecay = (
|
15
|
-
value: SkiaMutableValue<number>,
|
16
|
-
config?: DecayConfig
|
17
|
-
) => {
|
18
|
-
const resolvedConfig: DefaultDecayConfig = {
|
19
|
-
deceleration: 0.998,
|
20
|
-
velocityFactor: 1,
|
21
|
-
velocity: 0,
|
22
|
-
from: value.current,
|
23
|
-
...config,
|
24
|
-
};
|
25
|
-
const updateFunction = (t: number, state: DecayState | undefined) => {
|
26
|
-
if (!state) {
|
27
|
-
return {
|
28
|
-
current: resolvedConfig.from,
|
29
|
-
finished: false,
|
30
|
-
lastTimestamp: t,
|
31
|
-
startTimestamp: t,
|
32
|
-
initialVelocity: resolvedConfig.velocity,
|
33
|
-
velocity: resolvedConfig.velocity,
|
34
|
-
};
|
35
|
-
}
|
36
|
-
return decay(t, state, resolvedConfig);
|
37
|
-
};
|
38
|
-
value.animation = ValueApi.createAnimation(updateFunction);
|
39
|
-
return value.animation;
|
40
|
-
};
|
@@ -1,24 +0,0 @@
|
|
1
|
-
import type { AnimationState } from "../../values/types";
|
2
|
-
|
3
|
-
export interface DecayConfig {
|
4
|
-
from?: number;
|
5
|
-
deceleration?: number;
|
6
|
-
velocityFactor?: number;
|
7
|
-
clamp?: number[];
|
8
|
-
velocity?: number;
|
9
|
-
}
|
10
|
-
|
11
|
-
export interface DefaultDecayConfig {
|
12
|
-
from: number;
|
13
|
-
deceleration: number;
|
14
|
-
velocityFactor: number;
|
15
|
-
clamp?: number[];
|
16
|
-
velocity: number;
|
17
|
-
}
|
18
|
-
|
19
|
-
export interface DecayState extends AnimationState {
|
20
|
-
lastTimestamp: number;
|
21
|
-
startTimestamp: number;
|
22
|
-
initialVelocity: number;
|
23
|
-
velocity: number;
|
24
|
-
}
|
@@ -1,61 +0,0 @@
|
|
1
|
-
import type { SpringConfig } from "./types";
|
2
|
-
|
3
|
-
/*
|
4
|
-
Spring animation configurations
|
5
|
-
*/
|
6
|
-
const Config = {
|
7
|
-
Gentle: {
|
8
|
-
mass: 1,
|
9
|
-
stiffness: 170,
|
10
|
-
damping: 19,
|
11
|
-
velocity: 0,
|
12
|
-
},
|
13
|
-
Wobbly: {
|
14
|
-
mass: 1,
|
15
|
-
stiffness: 180,
|
16
|
-
damping: 12,
|
17
|
-
velocity: 0,
|
18
|
-
},
|
19
|
-
WobblySlow: {
|
20
|
-
mass: 4,
|
21
|
-
stiffness: 180,
|
22
|
-
damping: 25,
|
23
|
-
velocity: 0,
|
24
|
-
},
|
25
|
-
Stiff: {
|
26
|
-
mass: 1,
|
27
|
-
stiffness: 200,
|
28
|
-
damping: 20,
|
29
|
-
velocity: 0,
|
30
|
-
},
|
31
|
-
Default: {
|
32
|
-
mass: 1,
|
33
|
-
stiffness: 100,
|
34
|
-
damping: 10,
|
35
|
-
velocity: 0,
|
36
|
-
},
|
37
|
-
};
|
38
|
-
|
39
|
-
export const Spring = {
|
40
|
-
Config,
|
41
|
-
Gentle: (config: SpringConfig = {}) => ({
|
42
|
-
...Config.Gentle,
|
43
|
-
...config,
|
44
|
-
}),
|
45
|
-
Wobbly: (config: SpringConfig = {}) => ({
|
46
|
-
...Config.Wobbly,
|
47
|
-
...config,
|
48
|
-
}),
|
49
|
-
WobblySlow: (config: SpringConfig = {}) => ({
|
50
|
-
...Config.WobblySlow,
|
51
|
-
...config,
|
52
|
-
}),
|
53
|
-
Stiff: (config: SpringConfig = {}) => ({
|
54
|
-
...Config.Stiff,
|
55
|
-
...config,
|
56
|
-
}),
|
57
|
-
Default: (config: SpringConfig = {}) => ({
|
58
|
-
...Config.Default,
|
59
|
-
...config,
|
60
|
-
}),
|
61
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
export { createSpringEasing } from "./spring";
|
@@ -1,86 +0,0 @@
|
|
1
|
-
import type { SpringConfig } from "../types";
|
2
|
-
import type { TimingConfig } from "../../types";
|
3
|
-
|
4
|
-
/**
|
5
|
-
* @description Returns a cached jsContext function for a spring with duration
|
6
|
-
* @param mass The mass of the spring
|
7
|
-
* @param stiffness The stiffness of the spring
|
8
|
-
* @param damping Spring damping
|
9
|
-
* @param velocity The initial velocity
|
10
|
-
*/
|
11
|
-
export const createSpringEasing = (
|
12
|
-
params: Partial<SpringConfig>
|
13
|
-
): TimingConfig => {
|
14
|
-
const config = {
|
15
|
-
mass: 1,
|
16
|
-
stiffness: 100,
|
17
|
-
damping: 10,
|
18
|
-
velocity: 0,
|
19
|
-
...params,
|
20
|
-
};
|
21
|
-
config.velocity /= 100;
|
22
|
-
return getSpringEasing(config);
|
23
|
-
};
|
24
|
-
|
25
|
-
const getSpringEasing = (config: Required<SpringConfig>) => {
|
26
|
-
const { stiffness, mass, damping, velocity: initialVelocity } = config;
|
27
|
-
// Setup spring state
|
28
|
-
const state = {
|
29
|
-
w0: Math.sqrt(stiffness / mass),
|
30
|
-
zeta: 0,
|
31
|
-
wd: 0,
|
32
|
-
a: 1,
|
33
|
-
b: 0,
|
34
|
-
};
|
35
|
-
state.zeta = damping / (2 * Math.sqrt(stiffness * mass));
|
36
|
-
state.wd =
|
37
|
-
state.zeta < 1 ? state.w0 * Math.sqrt(1 - state.zeta * state.zeta) : 0;
|
38
|
-
state.a = 1;
|
39
|
-
state.b =
|
40
|
-
state.zeta < 1
|
41
|
-
? (state.zeta * state.w0 + -initialVelocity) / state.wd
|
42
|
-
: -initialVelocity + state.w0;
|
43
|
-
|
44
|
-
const update = (t: number, duration?: number) => {
|
45
|
-
let progress = duration ? (duration * t) / 1000 : t;
|
46
|
-
if (state.zeta < 1) {
|
47
|
-
progress =
|
48
|
-
Math.exp(-progress * state.zeta * state.w0) *
|
49
|
-
(state.a * Math.cos(state.wd * progress) +
|
50
|
-
state.b * Math.sin(state.wd * progress));
|
51
|
-
} else {
|
52
|
-
progress =
|
53
|
-
(state.a + state.b * progress) * Math.exp(-progress * state.w0);
|
54
|
-
}
|
55
|
-
if (t === 0 || t === 1) {
|
56
|
-
return t;
|
57
|
-
}
|
58
|
-
return 1 - progress;
|
59
|
-
};
|
60
|
-
|
61
|
-
const getDurationMs = () => {
|
62
|
-
var frame = 1 / 6;
|
63
|
-
var elapsed = 0;
|
64
|
-
var rest = 0;
|
65
|
-
while (true) {
|
66
|
-
elapsed += frame;
|
67
|
-
if (update(elapsed) === 1) {
|
68
|
-
rest++;
|
69
|
-
if (rest >= 6) {
|
70
|
-
break;
|
71
|
-
}
|
72
|
-
} else {
|
73
|
-
rest = 0;
|
74
|
-
}
|
75
|
-
}
|
76
|
-
var durationMs = elapsed * frame * 1000;
|
77
|
-
return durationMs + 1000;
|
78
|
-
};
|
79
|
-
|
80
|
-
const durationMs = getDurationMs();
|
81
|
-
|
82
|
-
return {
|
83
|
-
easing: (t: number) => update(t, durationMs),
|
84
|
-
duration: durationMs,
|
85
|
-
};
|
86
|
-
};
|
@@ -1,40 +0,0 @@
|
|
1
|
-
import type { SkiaMutableValue, SkiaAnimation } from "../../values/types";
|
2
|
-
import type {
|
3
|
-
AnimationParams,
|
4
|
-
SpringConfig,
|
5
|
-
AnimationCallback,
|
6
|
-
} from "../types";
|
7
|
-
import { runTiming } from "../timing/runTiming";
|
8
|
-
|
9
|
-
import { Spring } from "./Spring";
|
10
|
-
import { createSpringEasing } from "./functions/spring";
|
11
|
-
|
12
|
-
/**
|
13
|
-
* @deprecated Use Reanimated 3 for animations:
|
14
|
-
* https://shopify.github.io/react-native-skia/docs/animations/animations
|
15
|
-
*
|
16
|
-
* Creates a new animation on an existing value that will be driven by
|
17
|
-
* an animation value. The value will be run from / to the value in
|
18
|
-
* params and modified by the provided easing curve for the length of
|
19
|
-
* the duration. When the value has reached its desired "to" value the
|
20
|
-
* animation will be stopped.
|
21
|
-
*
|
22
|
-
* @param value The value to animate
|
23
|
-
* @param toOrParams To value or Animation parameters
|
24
|
-
* @param config Spring configuration
|
25
|
-
* @returns an animation value that can be used to start/stop
|
26
|
-
* the animation.
|
27
|
-
*/
|
28
|
-
export const runSpring = (
|
29
|
-
value: SkiaMutableValue<number>,
|
30
|
-
toOrParams: number | AnimationParams,
|
31
|
-
config?: SpringConfig,
|
32
|
-
callback?: AnimationCallback
|
33
|
-
): SkiaAnimation => {
|
34
|
-
return runTiming(
|
35
|
-
value,
|
36
|
-
toOrParams,
|
37
|
-
createSpringEasing(config ?? Spring.Config.Default),
|
38
|
-
callback
|
39
|
-
);
|
40
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import type { SkiaValue } from "../../values/types";
|
2
|
-
import type {
|
3
|
-
SpringConfig,
|
4
|
-
AnimationParams,
|
5
|
-
AnimationCallback,
|
6
|
-
} from "../types";
|
7
|
-
import { useTiming } from "../timing";
|
8
|
-
|
9
|
-
import { Spring } from "./Spring";
|
10
|
-
import { createSpringEasing } from "./functions/spring";
|
11
|
-
|
12
|
-
/**
|
13
|
-
* @deprecated Use Reanimated 3 for animations:
|
14
|
-
* https://shopify.github.io/react-native-skia/docs/animations/animations
|
15
|
-
*
|
16
|
-
* Creats a spring based animation value that will run whenever
|
17
|
-
* the animation parameters change.
|
18
|
-
* @param toOrParams
|
19
|
-
* @param config
|
20
|
-
* @returns
|
21
|
-
*/
|
22
|
-
export const useSpring = (
|
23
|
-
toOrParams: number | AnimationParams,
|
24
|
-
config?: SpringConfig,
|
25
|
-
callback?: AnimationCallback
|
26
|
-
): SkiaValue<number> =>
|
27
|
-
useTiming(
|
28
|
-
toOrParams,
|
29
|
-
createSpringEasing(config ?? Spring.Config.Default),
|
30
|
-
callback
|
31
|
-
);
|
@@ -1,102 +0,0 @@
|
|
1
|
-
// eslint-disable-next-line max-len
|
2
|
-
// Taken from https://github.com/facebook/react-native/blob/0b9ea60b4fee8cacc36e7160e31b91fc114dbc0d/Libraries/Animated/src/Easing.js
|
3
|
-
|
4
|
-
import { bezier } from "./functions";
|
5
|
-
|
6
|
-
export class Easing {
|
7
|
-
static step0(n: number): number {
|
8
|
-
return n > 0 ? 1 : 0;
|
9
|
-
}
|
10
|
-
|
11
|
-
static step1(n: number): number {
|
12
|
-
return n >= 1 ? 1 : 0;
|
13
|
-
}
|
14
|
-
|
15
|
-
static linear(t: number): number {
|
16
|
-
return t;
|
17
|
-
}
|
18
|
-
|
19
|
-
static ease(t: number): number {
|
20
|
-
return Easing.bezier(0.42, 0, 1, 1)(t);
|
21
|
-
}
|
22
|
-
|
23
|
-
static quad(t: number): number {
|
24
|
-
return t * t;
|
25
|
-
}
|
26
|
-
|
27
|
-
static cubic(t: number): number {
|
28
|
-
return t * t * t;
|
29
|
-
}
|
30
|
-
|
31
|
-
static poly(n: number): (t: number) => number {
|
32
|
-
return (t: number): number => t ** n;
|
33
|
-
}
|
34
|
-
|
35
|
-
static sin(t: number): number {
|
36
|
-
return 1 - Math.cos((t * Math.PI) / 2);
|
37
|
-
}
|
38
|
-
|
39
|
-
static circle(t: number): number {
|
40
|
-
return 1 - Math.sqrt(1 - t * t);
|
41
|
-
}
|
42
|
-
|
43
|
-
static exp(t: number): number {
|
44
|
-
return 2 ** (10 * (t - 1));
|
45
|
-
}
|
46
|
-
|
47
|
-
static elastic(bounciness = 1): (t: number) => number {
|
48
|
-
const p = bounciness * Math.PI;
|
49
|
-
return (t): number =>
|
50
|
-
1 - Math.cos((t * Math.PI) / 2) ** 3 * Math.cos(t * p);
|
51
|
-
}
|
52
|
-
|
53
|
-
static back(s = 1.70158): (t: number) => number {
|
54
|
-
return (t): number => t * t * ((s + 1) * t - s);
|
55
|
-
}
|
56
|
-
|
57
|
-
static bounce(t: number): number {
|
58
|
-
if (t < 1 / 2.75) {
|
59
|
-
return 7.5625 * t * t;
|
60
|
-
}
|
61
|
-
|
62
|
-
if (t < 2 / 2.75) {
|
63
|
-
const t2_ = t - 1.5 / 2.75;
|
64
|
-
return 7.5625 * t2_ * t2_ + 0.75;
|
65
|
-
}
|
66
|
-
|
67
|
-
if (t < 2.5 / 2.75) {
|
68
|
-
const t2_ = t - 2.25 / 2.75;
|
69
|
-
return 7.5625 * t2_ * t2_ + 0.9375;
|
70
|
-
}
|
71
|
-
|
72
|
-
const t2 = t - 2.625 / 2.75;
|
73
|
-
return 7.5625 * t2 * t2 + 0.984375;
|
74
|
-
}
|
75
|
-
|
76
|
-
static bezier(
|
77
|
-
x1: number,
|
78
|
-
y1: number,
|
79
|
-
x2: number,
|
80
|
-
y2: number
|
81
|
-
): (t: number) => number {
|
82
|
-
return bezier(x1, y1, x2, y2);
|
83
|
-
}
|
84
|
-
|
85
|
-
static in(easing: (t: number) => number): (t: number) => number {
|
86
|
-
return easing;
|
87
|
-
}
|
88
|
-
|
89
|
-
static out(easing: (t: number) => number): (t: number) => number {
|
90
|
-
return (t): number => 1 - easing(1 - t);
|
91
|
-
}
|
92
|
-
|
93
|
-
static inOut(easing: (t: number) => number): (t: number) => number {
|
94
|
-
return (t): number => {
|
95
|
-
if (t < 0.5) {
|
96
|
-
return easing(t * 2) / 2;
|
97
|
-
}
|
98
|
-
|
99
|
-
return 1 - easing((1 - t) * 2) / 2;
|
100
|
-
};
|
101
|
-
}
|
102
|
-
}
|
@@ -1,62 +0,0 @@
|
|
1
|
-
import type {
|
2
|
-
TimingConfig,
|
3
|
-
RequiredAnimationParams,
|
4
|
-
AnimationCallback,
|
5
|
-
} from "../types";
|
6
|
-
import type { AnimationState, SkiaMutableValue } from "../../values/types";
|
7
|
-
import { ValueApi } from "../../values/api";
|
8
|
-
|
9
|
-
import { timing } from "./functions";
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Creates an animation that is driven by a clock value.
|
13
|
-
* The value will be run from / to the value in params and modified
|
14
|
-
* by the provided easing curve for the length of the duration. When
|
15
|
-
* the value has reached its desired "to" value the animation
|
16
|
-
* will be stopped. If loop is set to true, the animation will continue
|
17
|
-
* to run until stopped.
|
18
|
-
*
|
19
|
-
* @param params Animation parameters
|
20
|
-
* @param config Spring or timing configuration
|
21
|
-
* @param value Optional value that the animation will update
|
22
|
-
* @params an animation value that can be used to start/stop
|
23
|
-
* the animation.
|
24
|
-
*/
|
25
|
-
export const createTiming = (
|
26
|
-
params: RequiredAnimationParams & Required<TimingConfig>,
|
27
|
-
value?: SkiaMutableValue<number>,
|
28
|
-
callback?: AnimationCallback
|
29
|
-
) => {
|
30
|
-
// Update from to be either the declared from value,
|
31
|
-
// the current value of the value or zero
|
32
|
-
const resolvedParams = {
|
33
|
-
...params,
|
34
|
-
from: params.from ?? value?.current ?? 0,
|
35
|
-
};
|
36
|
-
|
37
|
-
// Update function for the animation value
|
38
|
-
const animationFunction = (t: number, state: AnimationState | undefined) => {
|
39
|
-
// Update the input value using the provided update function
|
40
|
-
const nextState = timing(
|
41
|
-
t,
|
42
|
-
params.duration,
|
43
|
-
params.easing,
|
44
|
-
params.loop ?? false,
|
45
|
-
params.yoyo ?? false,
|
46
|
-
state ?? { current: params.from!, finished: false }
|
47
|
-
);
|
48
|
-
const current =
|
49
|
-
nextState.current * (resolvedParams.to - resolvedParams.from!) +
|
50
|
-
resolvedParams.from!;
|
51
|
-
if (callback && nextState.finished === true) {
|
52
|
-
callback(current);
|
53
|
-
}
|
54
|
-
return {
|
55
|
-
...nextState,
|
56
|
-
current,
|
57
|
-
};
|
58
|
-
};
|
59
|
-
|
60
|
-
// Create animation value
|
61
|
-
return ValueApi.createAnimation(animationFunction);
|
62
|
-
};
|