@rafaelaugusto/jolt 0.1.0-beta.9 → 0.1.0-rc.2
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/README.md +167 -21
- package/dist/animate.d.ts +25 -4
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +67 -26
- package/dist/animate.js.map +1 -1
- package/dist/blur/index.d.ts +6 -0
- package/dist/blur/index.d.ts.map +1 -0
- package/dist/blur/index.js +196 -0
- package/dist/blur/index.js.map +1 -0
- package/dist/blur/native.d.ts +17 -0
- package/dist/blur/native.d.ts.map +1 -0
- package/dist/blur/native.js +44 -0
- package/dist/blur/native.js.map +1 -0
- package/dist/blur/types.d.ts +32 -0
- package/dist/blur/types.d.ts.map +1 -0
- package/dist/blur/types.js +2 -0
- package/dist/blur/types.js.map +1 -0
- package/dist/bottom-sheet/geometry.d.ts +18 -0
- package/dist/bottom-sheet/geometry.d.ts.map +1 -0
- package/dist/bottom-sheet/geometry.js +51 -0
- package/dist/bottom-sheet/geometry.js.map +1 -0
- package/dist/bottom-sheet/index.d.ts +56 -0
- package/dist/bottom-sheet/index.d.ts.map +1 -0
- package/dist/bottom-sheet/index.js +462 -0
- package/dist/bottom-sheet/index.js.map +1 -0
- package/dist/bottom-sheet/native.d.ts +11 -0
- package/dist/bottom-sheet/native.d.ts.map +1 -0
- package/dist/bottom-sheet/native.js +173 -0
- package/dist/bottom-sheet/native.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -1
- package/dist/config.js.map +1 -1
- package/dist/decay.d.ts +1 -0
- package/dist/decay.d.ts.map +1 -1
- package/dist/decay.js +7 -0
- package/dist/decay.js.map +1 -1
- package/dist/drag-physics.d.ts +6 -1
- package/dist/drag-physics.d.ts.map +1 -1
- package/dist/drag.d.ts +17 -3
- package/dist/drag.d.ts.map +1 -1
- package/dist/drag.js +34 -11
- package/dist/drag.js.map +1 -1
- package/dist/driver/android-gradient.d.ts +5 -0
- package/dist/driver/android-gradient.d.ts.map +1 -0
- package/dist/driver/android-gradient.js +99 -0
- package/dist/driver/android-gradient.js.map +1 -0
- package/dist/driver/android-particles.d.ts +6 -0
- package/dist/driver/android-particles.d.ts.map +1 -0
- package/dist/driver/android-particles.js +93 -0
- package/dist/driver/android-particles.js.map +1 -0
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +27 -1
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/frame.d.ts +3 -0
- package/dist/driver/frame.d.ts.map +1 -0
- package/dist/driver/frame.js +7 -0
- package/dist/driver/frame.js.map +1 -0
- package/dist/driver/index.d.ts +4 -0
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-gradient.d.ts +5 -0
- package/dist/driver/ios-gradient.d.ts.map +1 -0
- package/dist/driver/ios-gradient.js +131 -0
- package/dist/driver/ios-gradient.js.map +1 -0
- package/dist/driver/ios-scroll-delegate.d.ts +4 -0
- package/dist/driver/ios-scroll-delegate.d.ts.map +1 -0
- package/dist/driver/ios-scroll-delegate.js +26 -0
- package/dist/driver/ios-scroll-delegate.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +9 -0
- package/dist/driver/ios.js.map +1 -1
- package/dist/easing.d.ts +3 -1
- package/dist/easing.d.ts.map +1 -1
- package/dist/easing.js +18 -1
- package/dist/easing.js.map +1 -1
- package/dist/engine.d.ts +31 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +194 -42
- package/dist/engine.js.map +1 -1
- package/dist/gesture-native.d.ts +28 -0
- package/dist/gesture-native.d.ts.map +1 -0
- package/dist/gesture-native.js +61 -0
- package/dist/gesture-native.js.map +1 -0
- package/dist/gestures/index.d.ts +69 -0
- package/dist/gestures/index.d.ts.map +1 -0
- package/dist/gestures/index.js +262 -0
- package/dist/gestures/index.js.map +1 -0
- package/dist/glass/index.d.ts +55 -0
- package/dist/glass/index.d.ts.map +1 -0
- package/dist/glass/index.js +205 -0
- package/dist/glass/index.js.map +1 -0
- package/dist/gradient-binding.d.ts +38 -0
- package/dist/gradient-binding.d.ts.map +1 -0
- package/dist/gradient-binding.js +128 -0
- package/dist/gradient-binding.js.map +1 -0
- package/dist/gradient.d.ts +105 -0
- package/dist/gradient.d.ts.map +1 -0
- package/dist/gradient.js +514 -0
- package/dist/gradient.js.map +1 -0
- package/dist/gravity.d.ts +13 -0
- package/dist/gravity.d.ts.map +1 -0
- package/dist/gravity.js +84 -0
- package/dist/gravity.js.map +1 -0
- package/dist/haptics.d.ts.map +1 -1
- package/dist/haptics.js +101 -28
- package/dist/haptics.js.map +1 -1
- package/dist/image-effect.d.ts +1 -0
- package/dist/image-effect.d.ts.map +1 -1
- package/dist/image-effect.js +10 -2
- package/dist/image-effect.js.map +1 -1
- package/dist/index.d.ts +19 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/inspector/index.d.ts +86 -0
- package/dist/inspector/index.d.ts.map +1 -0
- package/dist/inspector/index.js +419 -0
- package/dist/inspector/index.js.map +1 -0
- package/dist/inspector/plot.d.ts +4 -0
- package/dist/inspector/plot.d.ts.map +1 -0
- package/dist/inspector/plot.js +23 -0
- package/dist/inspector/plot.js.map +1 -0
- package/dist/inspector/probe.d.ts +19 -0
- package/dist/inspector/probe.d.ts.map +1 -0
- package/dist/inspector/probe.js +37 -0
- package/dist/inspector/probe.js.map +1 -0
- package/dist/inspector/tuning.d.ts +19 -0
- package/dist/inspector/tuning.d.ts.map +1 -0
- package/dist/inspector/tuning.js +37 -0
- package/dist/inspector/tuning.js.map +1 -0
- package/dist/interactive-navigation/index.d.ts +44 -0
- package/dist/interactive-navigation/index.d.ts.map +1 -0
- package/dist/interactive-navigation/index.js +350 -0
- package/dist/interactive-navigation/index.js.map +1 -0
- package/dist/keyboard.d.ts +24 -0
- package/dist/keyboard.d.ts.map +1 -1
- package/dist/keyboard.js +199 -6
- package/dist/keyboard.js.map +1 -1
- package/dist/live-spring-driver.d.ts +52 -0
- package/dist/live-spring-driver.d.ts.map +1 -0
- package/dist/live-spring-driver.js +104 -0
- package/dist/live-spring-driver.js.map +1 -0
- package/dist/mixer.d.ts +55 -0
- package/dist/mixer.d.ts.map +1 -0
- package/dist/mixer.js +286 -0
- package/dist/mixer.js.map +1 -0
- package/dist/motion-scope.d.ts +8 -2
- package/dist/motion-scope.d.ts.map +1 -1
- package/dist/motion-scope.js +24 -3
- package/dist/motion-scope.js.map +1 -1
- package/dist/motion-states.d.ts +19 -7
- package/dist/motion-states.d.ts.map +1 -1
- package/dist/motion-states.js +116 -26
- package/dist/motion-states.js.map +1 -1
- package/dist/motion-value.d.ts +227 -0
- package/dist/motion-value.d.ts.map +1 -0
- package/dist/motion-value.js +1074 -0
- package/dist/motion-value.js.map +1 -0
- package/dist/native/index.d.ts +10 -0
- package/dist/native/index.d.ts.map +1 -0
- package/dist/native/index.js +6 -0
- package/dist/native/index.js.map +1 -0
- package/dist/native-properties.d.ts +28 -0
- package/dist/native-properties.d.ts.map +1 -0
- package/dist/native-properties.js +154 -0
- package/dist/native-properties.js.map +1 -0
- package/dist/native-property-driver.d.ts +19 -0
- package/dist/native-property-driver.d.ts.map +1 -0
- package/dist/native-property-driver.js +69 -0
- package/dist/native-property-driver.js.map +1 -0
- package/dist/native-property.d.ts +37 -0
- package/dist/native-property.d.ts.map +1 -0
- package/dist/native-property.js +285 -0
- package/dist/native-property.js.map +1 -0
- package/dist/particles.d.ts +5 -2
- package/dist/particles.d.ts.map +1 -1
- package/dist/particles.js +16 -10
- package/dist/particles.js.map +1 -1
- package/dist/path.d.ts.map +1 -1
- package/dist/path.js +2 -2
- package/dist/path.js.map +1 -1
- package/dist/physics/index.d.ts +139 -0
- package/dist/physics/index.d.ts.map +1 -0
- package/dist/physics/index.js +316 -0
- package/dist/physics/index.js.map +1 -0
- package/dist/physics/native.d.ts +54 -0
- package/dist/physics/native.d.ts.map +1 -0
- package/dist/physics/native.js +64 -0
- package/dist/physics/native.js.map +1 -0
- package/dist/playback-group.d.ts.map +1 -1
- package/dist/playback-group.js +17 -1
- package/dist/playback-group.js.map +1 -1
- package/dist/playback.d.ts +15 -0
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +23 -0
- package/dist/playback.js.map +1 -1
- package/dist/predictive-back/index.d.ts +45 -0
- package/dist/predictive-back/index.d.ts.map +1 -0
- package/dist/predictive-back/index.js +220 -0
- package/dist/predictive-back/index.js.map +1 -0
- package/dist/predictive-back/presentation.d.ts +4 -0
- package/dist/predictive-back/presentation.d.ts.map +1 -0
- package/dist/predictive-back/presentation.js +3 -0
- package/dist/predictive-back/presentation.js.map +1 -0
- package/dist/press.d.ts.map +1 -1
- package/dist/press.js +11 -2
- package/dist/press.js.map +1 -1
- package/dist/reorder/handle.d.ts +6 -0
- package/dist/reorder/handle.d.ts.map +1 -0
- package/dist/reorder/handle.js +10 -0
- package/dist/reorder/handle.js.map +1 -0
- package/dist/reorder/index.d.ts +10 -0
- package/dist/reorder/index.d.ts.map +1 -0
- package/dist/reorder/index.js +233 -0
- package/dist/reorder/index.js.map +1 -0
- package/dist/reorder/list-view.d.ts +5 -0
- package/dist/reorder/list-view.d.ts.map +1 -0
- package/dist/reorder/list-view.js +238 -0
- package/dist/reorder/list-view.js.map +1 -0
- package/dist/reorder/model.d.ts +6 -0
- package/dist/reorder/model.d.ts.map +1 -0
- package/dist/reorder/model.js +30 -0
- package/dist/reorder/model.js.map +1 -0
- package/dist/reorder/surface.d.ts +6 -0
- package/dist/reorder/surface.d.ts.map +1 -0
- package/dist/reorder/surface.js +10 -0
- package/dist/reorder/surface.js.map +1 -0
- package/dist/reorder/types.d.ts +92 -0
- package/dist/reorder/types.d.ts.map +1 -0
- package/dist/reorder/types.js +2 -0
- package/dist/reorder/types.js.map +1 -0
- package/dist/sampling.d.ts +35 -0
- package/dist/sampling.d.ts.map +1 -0
- package/dist/sampling.js +123 -0
- package/dist/sampling.js.map +1 -0
- package/dist/scene-appearance.d.ts +14 -0
- package/dist/scene-appearance.d.ts.map +1 -0
- package/dist/scene-appearance.js +68 -0
- package/dist/scene-appearance.js.map +1 -0
- package/dist/scene-camera.d.ts +5 -0
- package/dist/scene-camera.d.ts.map +1 -0
- package/dist/scene-camera.js +23 -0
- package/dist/scene-camera.js.map +1 -0
- package/dist/scene-shader.d.ts +18 -0
- package/dist/scene-shader.d.ts.map +1 -0
- package/dist/scene-shader.js +76 -0
- package/dist/scene-shader.js.map +1 -0
- package/dist/scroll-header/geometry.d.ts +18 -0
- package/dist/scroll-header/geometry.d.ts.map +1 -0
- package/dist/scroll-header/geometry.js +46 -0
- package/dist/scroll-header/geometry.js.map +1 -0
- package/dist/scroll-header/index.d.ts +48 -0
- package/dist/scroll-header/index.d.ts.map +1 -0
- package/dist/scroll-header/index.js +399 -0
- package/dist/scroll-header/index.js.map +1 -0
- package/dist/scroll-header/native.d.ts +28 -0
- package/dist/scroll-header/native.d.ts.map +1 -0
- package/dist/scroll-header/native.js +43 -0
- package/dist/scroll-header/native.js.map +1 -0
- package/dist/sensors/index.d.ts +69 -0
- package/dist/sensors/index.d.ts.map +1 -0
- package/dist/sensors/index.js +149 -0
- package/dist/sensors/index.js.map +1 -0
- package/dist/sensors/native.d.ts +20 -0
- package/dist/sensors/native.d.ts.map +1 -0
- package/dist/sensors/native.js +48 -0
- package/dist/sensors/native.js.map +1 -0
- package/dist/sequence.d.ts +24 -0
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +181 -19
- package/dist/sequence.js.map +1 -1
- package/dist/shapes/android.d.ts +3 -0
- package/dist/shapes/android.d.ts.map +1 -0
- package/dist/shapes/android.js +51 -0
- package/dist/shapes/android.js.map +1 -0
- package/dist/shapes/index.d.ts +6 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +238 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/ios.d.ts +3 -0
- package/dist/shapes/ios.d.ts.map +1 -0
- package/dist/shapes/ios.js +164 -0
- package/dist/shapes/ios.js.map +1 -0
- package/dist/shapes/native.d.ts +18 -0
- package/dist/shapes/native.d.ts.map +1 -0
- package/dist/shapes/native.js +10 -0
- package/dist/shapes/native.js.map +1 -0
- package/dist/shapes/path.d.ts +10 -0
- package/dist/shapes/path.d.ts.map +1 -0
- package/dist/shapes/path.js +106 -0
- package/dist/shapes/path.js.map +1 -0
- package/dist/shapes/types.d.ts +55 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +11 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shared-layout/index.d.ts +40 -0
- package/dist/shared-layout/index.d.ts.map +1 -0
- package/dist/shared-layout/index.js +267 -0
- package/dist/shared-layout/index.js.map +1 -0
- package/dist/shared-layout/native.d.ts +15 -0
- package/dist/shared-layout/native.d.ts.map +1 -0
- package/dist/shared-layout/native.js +79 -0
- package/dist/shared-layout/native.js.map +1 -0
- package/dist/shared-layout/timing.d.ts +9 -0
- package/dist/shared-layout/timing.d.ts.map +1 -0
- package/dist/shared-layout/timing.js +68 -0
- package/dist/shared-layout/timing.js.map +1 -0
- package/dist/shared-navigation/entry.d.ts +51 -0
- package/dist/shared-navigation/entry.d.ts.map +1 -0
- package/dist/shared-navigation/entry.js +619 -0
- package/dist/shared-navigation/entry.js.map +1 -0
- package/dist/shared-navigation/index.d.ts +58 -0
- package/dist/shared-navigation/index.d.ts.map +1 -0
- package/dist/shared-navigation/index.js +318 -0
- package/dist/shared-navigation/index.js.map +1 -0
- package/dist/shared-navigation/return-signal.d.ts +16 -0
- package/dist/shared-navigation/return-signal.d.ts.map +1 -0
- package/dist/shared-navigation/return-signal.js +35 -0
- package/dist/shared-navigation/return-signal.js.map +1 -0
- package/dist/shared-navigation/return-target.d.ts +32 -0
- package/dist/shared-navigation/return-target.d.ts.map +1 -0
- package/dist/shared-navigation/return-target.js +168 -0
- package/dist/shared-navigation/return-target.js.map +1 -0
- package/dist/shared-navigation/scope.d.ts +4 -0
- package/dist/shared-navigation/scope.d.ts.map +1 -0
- package/dist/shared-navigation/scope.js +2 -0
- package/dist/shared-navigation/scope.js.map +1 -0
- package/dist/shared-navigation/targets.d.ts +6 -0
- package/dist/shared-navigation/targets.d.ts.map +1 -0
- package/dist/shared-navigation/targets.js +36 -0
- package/dist/shared-navigation/targets.js.map +1 -0
- package/dist/size-layout.d.ts +19 -0
- package/dist/size-layout.d.ts.map +1 -0
- package/dist/size-layout.js +216 -0
- package/dist/size-layout.js.map +1 -0
- package/dist/size.d.ts +19 -0
- package/dist/size.d.ts.map +1 -0
- package/dist/size.js +251 -0
- package/dist/size.js.map +1 -0
- package/dist/spring.d.ts +2 -0
- package/dist/spring.d.ts.map +1 -1
- package/dist/spring.js +11 -0
- package/dist/spring.js.map +1 -1
- package/dist/svg-path.d.ts +18 -0
- package/dist/svg-path.d.ts.map +1 -1
- package/dist/svg-path.js +3 -2
- package/dist/svg-path.js.map +1 -1
- package/dist/testing/clock.d.ts +40 -0
- package/dist/testing/clock.d.ts.map +1 -0
- package/dist/testing/clock.js +116 -0
- package/dist/testing/clock.js.map +1 -0
- package/dist/testing/handoff-recorder.d.ts +8 -0
- package/dist/testing/handoff-recorder.d.ts.map +1 -0
- package/dist/testing/handoff-recorder.js +77 -0
- package/dist/testing/handoff-recorder.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/native.d.ts +46 -0
- package/dist/testing/native.d.ts.map +1 -0
- package/dist/testing/native.js +313 -0
- package/dist/testing/native.js.map +1 -0
- package/dist/testing/presentation.d.ts +11 -0
- package/dist/testing/presentation.d.ts.map +1 -0
- package/dist/testing/presentation.js +45 -0
- package/dist/testing/presentation.js.map +1 -0
- package/dist/testing/replay.d.ts +39 -0
- package/dist/testing/replay.d.ts.map +1 -0
- package/dist/testing/replay.js +99 -0
- package/dist/testing/replay.js.map +1 -0
- package/dist/testing/scroll-handoff-native.d.ts +10 -0
- package/dist/testing/scroll-handoff-native.d.ts.map +1 -0
- package/dist/testing/scroll-handoff-native.js +151 -0
- package/dist/testing/scroll-handoff-native.js.map +1 -0
- package/dist/testing/scroll-handoff.d.ts +25 -0
- package/dist/testing/scroll-handoff.d.ts.map +1 -0
- package/dist/testing/scroll-handoff.js +127 -0
- package/dist/testing/scroll-handoff.js.map +1 -0
- package/dist/testing/sensors.d.ts +13 -0
- package/dist/testing/sensors.d.ts.map +1 -0
- package/dist/testing/sensors.js +26 -0
- package/dist/testing/sensors.js.map +1 -0
- package/dist/testing/trace.d.ts +101 -0
- package/dist/testing/trace.d.ts.map +1 -0
- package/dist/testing/trace.js +263 -0
- package/dist/testing/trace.js.map +1 -0
- package/dist/timed-animation.d.ts +38 -0
- package/dist/timed-animation.d.ts.map +1 -0
- package/dist/timed-animation.js +177 -0
- package/dist/timed-animation.js.map +1 -0
- package/dist/track.d.ts +3 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +281 -40
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +54 -2
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +128 -8
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +10 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/value-observers.d.ts +22 -0
- package/dist/value-observers.d.ts.map +1 -0
- package/dist/value-observers.js +122 -0
- package/dist/value-observers.js.map +1 -0
- package/dist/value-track.d.ts +13 -0
- package/dist/value-track.d.ts.map +1 -0
- package/dist/value-track.js +59 -0
- package/dist/value-track.js.map +1 -0
- package/dist/vue/index.d.ts +33 -3
- package/dist/vue/index.d.ts.map +1 -1
- package/dist/vue/index.js +118 -3
- package/dist/vue/index.js.map +1 -1
- package/dist/zoomable.d.ts +1 -1
- package/dist/zoomable.d.ts.map +1 -1
- package/package.json +68 -3
- package/platforms/android/include.gradle +10 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/BlurEffect.java +89 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleMath.java +158 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/CircleWorld.java +221 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSession.java +227 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GestureSurface.java +54 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/GradientLayer.java +224 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrame.java +53 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardFrameFollower.java +57 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/KeyboardObserver.java +97 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/LiveSpring.java +277 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/MotionProbe.java +70 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleEmitter.java +192 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ParticleSimulation.java +114 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/PredictiveBackSession.java +212 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderHandle.java +25 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSession.java +213 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ReorderSurface.java +27 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ScrollHeader.java +84 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorMath.java +28 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SensorSource.java +217 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ShapeLayer.java +120 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedLayoutFlight.java +287 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SharedNavigationScene.java +115 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/SpringState.java +39 -0
- package/platforms/android/proguard-rules.pro +20 -0
- package/platforms/ios/build.xcconfig +1 -1
- package/platforms/ios/src/JoltBlur.h +14 -0
- package/platforms/ios/src/JoltBlur.m +86 -0
- package/platforms/ios/src/JoltCircleMath.h +191 -0
- package/platforms/ios/src/JoltCircleWorld.h +18 -0
- package/platforms/ios/src/JoltCircleWorld.m +218 -0
- package/platforms/ios/src/JoltGestureSession.h +23 -0
- package/platforms/ios/src/JoltGestureSession.m +251 -0
- package/platforms/ios/src/JoltInteractiveNavigation.h +23 -0
- package/platforms/ios/src/JoltInteractiveNavigation.m +255 -0
- package/platforms/ios/src/JoltLiveSpring.h +29 -0
- package/platforms/ios/src/JoltLiveSpring.m +243 -0
- package/platforms/ios/src/JoltMotionProbe.h +9 -0
- package/platforms/ios/src/JoltMotionProbe.m +72 -0
- package/platforms/ios/src/JoltReorderSession.h +15 -0
- package/platforms/ios/src/JoltReorderSession.m +205 -0
- package/platforms/ios/src/JoltScrollHeader.h +13 -0
- package/platforms/ios/src/JoltScrollHeader.m +101 -0
- package/platforms/ios/src/JoltSensorMath.h +39 -0
- package/platforms/ios/src/JoltSensorSource.h +13 -0
- package/platforms/ios/src/JoltSensorSource.m +201 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.h +19 -0
- package/platforms/ios/src/JoltSharedLayoutFlight.m +250 -0
- package/platforms/ios/src/JoltSpringState.h +35 -0
- package/platforms/ios/src/module.modulemap +10 -0
- package/src/android-plugin.d.ts +464 -0
- package/src/animate.ts +129 -15
- package/src/blur/index.ts +195 -0
- package/src/blur/native.ts +70 -0
- package/src/blur/types.ts +32 -0
- package/src/bottom-sheet/geometry.ts +84 -0
- package/src/bottom-sheet/index.ts +536 -0
- package/src/bottom-sheet/native.ts +214 -0
- package/src/config.ts +39 -1
- package/src/decay.ts +9 -0
- package/src/drag.ts +67 -21
- package/src/driver/android-gradient.ts +116 -0
- package/src/driver/android-particles.ts +118 -0
- package/src/driver/android.ts +31 -1
- package/src/driver/frame.ts +10 -0
- package/src/driver/index.ts +4 -0
- package/src/driver/ios-gradient.ts +136 -0
- package/src/driver/ios-scroll-delegate.ts +23 -0
- package/src/driver/ios.ts +10 -0
- package/src/easing.ts +21 -1
- package/src/engine.ts +209 -60
- package/src/gesture-native.ts +139 -0
- package/src/gestures/index.ts +365 -0
- package/src/glass/index.ts +218 -0
- package/src/gradient-binding.ts +158 -0
- package/src/gradient.ts +663 -0
- package/src/gravity.ts +107 -0
- package/src/haptics.ts +106 -28
- package/src/image-effect.ts +10 -2
- package/src/index.ts +56 -7
- package/src/inspector/index.ts +523 -0
- package/src/inspector/plot.ts +27 -0
- package/src/inspector/probe.ts +50 -0
- package/src/inspector/tuning.ts +51 -0
- package/src/interactive-navigation/index.ts +427 -0
- package/src/ios-plugin.d.ts +280 -0
- package/src/keyboard.ts +231 -7
- package/src/live-spring-driver.ts +181 -0
- package/src/mixer.ts +312 -0
- package/src/motion-scope.ts +39 -6
- package/src/motion-states.ts +149 -42
- package/src/motion-value.ts +1289 -0
- package/src/native/index.ts +30 -0
- package/src/native-properties.ts +188 -0
- package/src/native-property-driver.ts +123 -0
- package/src/native-property.ts +366 -0
- package/src/particles.ts +18 -17
- package/src/path.ts +2 -1
- package/src/physics/index.ts +476 -0
- package/src/physics/native.ts +121 -0
- package/src/playback-group.ts +17 -1
- package/src/playback.ts +41 -0
- package/src/predictive-back/index.ts +280 -0
- package/src/predictive-back/presentation.ts +6 -0
- package/src/press.ts +10 -2
- package/src/reorder/handle.ts +9 -0
- package/src/reorder/index.ts +243 -0
- package/src/reorder/list-view.ts +262 -0
- package/src/reorder/model.ts +47 -0
- package/src/reorder/surface.ts +10 -0
- package/src/reorder/types.ts +87 -0
- package/src/sampling.ts +173 -0
- package/src/scene-appearance.ts +92 -0
- package/src/scene-camera.ts +30 -0
- package/src/scene-shader.ts +139 -0
- package/src/scroll-header/geometry.ts +88 -0
- package/src/scroll-header/index.ts +530 -0
- package/src/scroll-header/native.ts +89 -0
- package/src/sensors/index.ts +246 -0
- package/src/sensors/native.ts +72 -0
- package/src/sequence.ts +209 -20
- package/src/shapes/android.ts +63 -0
- package/src/shapes/index.ts +267 -0
- package/src/shapes/ios.ts +194 -0
- package/src/shapes/native.ts +27 -0
- package/src/shapes/path.ts +127 -0
- package/src/shapes/types.ts +63 -0
- package/src/shared-layout/index.ts +343 -0
- package/src/shared-layout/native.ts +138 -0
- package/src/shared-layout/timing.ts +87 -0
- package/src/shared-navigation/entry.ts +695 -0
- package/src/shared-navigation/index.ts +414 -0
- package/src/shared-navigation/return-signal.ts +41 -0
- package/src/shared-navigation/return-target.ts +197 -0
- package/src/shared-navigation/scope.ts +3 -0
- package/src/shared-navigation/targets.ts +38 -0
- package/src/size-layout.ts +237 -0
- package/src/size.ts +302 -0
- package/src/spring.ts +18 -0
- package/src/svg-path.ts +8 -3
- package/src/testing/clock.ts +128 -0
- package/src/testing/handoff-recorder.ts +98 -0
- package/src/testing/index.ts +4 -0
- package/src/testing/native.ts +386 -0
- package/src/testing/presentation.ts +46 -0
- package/src/testing/replay.ts +149 -0
- package/src/testing/scroll-handoff-native.ts +201 -0
- package/src/testing/scroll-handoff.ts +140 -0
- package/src/testing/sensors.ts +41 -0
- package/src/testing/trace.ts +340 -0
- package/src/timed-animation.ts +192 -0
- package/src/track.ts +334 -38
- package/src/transition.ts +197 -9
- package/src/types.ts +11 -1
- package/src/value-observers.ts +147 -0
- package/src/value-track.ts +71 -0
- package/src/vue/index.ts +147 -1
- package/src/zoomable.ts +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</p>
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
|
-
<a href="https://jolt.rafaelaugusto.dev">
|
|
19
|
+
<a href="https://jolt.rafaelaugusto.dev">English</a> · <a href="https://jolt.rafaelaugusto.dev/pt-BR/">Português</a> · <a href="https://jolt.rafaelaugusto.dev/es/">Español</a> · <a href="https://jolt.rafaelaugusto.dev/zh-Hans/">简体中文</a>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
22
|
```ts
|
|
@@ -29,7 +29,9 @@ animate(rows, 'fadeInUp', { stagger: 40 })
|
|
|
29
29
|
|
|
30
30
|
NativeScript's `view.animate()` covers the basics and stops there: one curve for every property, a `spring` curve with no settings, no keyframes, and a promise that rejects when the animation is cancelled. Anything richer ends up as platform code.
|
|
31
31
|
|
|
32
|
-
Jolt computes the motion once, in JavaScript, when the animation starts, and hands it to the platform as keyframes: Core Animation on iOS, `ObjectAnimator` on Android.
|
|
32
|
+
Jolt computes the motion once, in JavaScript, when the animation starts, and hands it to the platform as keyframes: Core Animation on iOS, `ObjectAnimator` on Android. Those default view tracks play without per-frame JavaScript. Real-size layout, opt-in subscribers, gesture input and timeline step activation retain their documented [execution limits](https://jolt.rafaelaugusto.dev/guide/how-it-works). Springs follow real physics, and an animation that interrupts another one starts from where the view is, at the speed it was going.
|
|
33
|
+
|
|
34
|
+
The [0.1.0-rc.2 release candidate](https://github.com/rafaelaugustos/jolt/releases/tag/v0.1.0-rc.2) fixes scroll anchors through resize/reload, iOS interactive navigation after backgrounding, layered press release and native composition timing. It includes opt-in native pointer springs and Android gallery lifecycle validation. The preview has **74 examples in English, Portuguese, Spanish and Simplified Chinese**, with light/dark themes. The RC phase continues with compatibility and [physical-device acceptance](https://jolt.rafaelaugusto.dev/guide/not-there-yet). Install `@rafaelaugusto/jolt@0.1.0-rc.2` and rebuild the native app. For external native properties, also install matching `@rafaelaugusto/jolt-native@0.1.0-rc.2`.
|
|
33
35
|
|
|
34
36
|
## Features
|
|
35
37
|
|
|
@@ -38,15 +40,39 @@ Jolt computes the motion once, in JavaScript, when the animation starts, and han
|
|
|
38
40
|
- [Corners, borders and shadows](#corners-borders-and-shadows) with native playback and selective stopping.
|
|
39
41
|
- [Motion paths](#motion-along-a-path) with optional tangent orientation on iOS and Android.
|
|
40
42
|
- [Colors](#colors) for backgrounds, borders and text, interpolated in OKLab on iOS and Android.
|
|
41
|
-
- [Motion
|
|
43
|
+
- [Motion values](#motion-values): one value driving several properties and views, mapped like `interpolate`.
|
|
44
|
+
- [Live springs](https://jolt.rafaelaugusto.dev/guide/live-springs): retained native followers with position and velocity that continue through target changes.
|
|
45
|
+
- [Native gestures](https://jolt.rafaelaugusto.dev/guide/gestures): simultaneous pan/pinch/rotation, tap arbitration, axis competition and vertical Core ScrollView handoff.
|
|
46
|
+
- [Bottom sheet](https://jolt.rafaelaugusto.dev/guide/bottom-sheet): native drag/scroll handoff, content and percentage stops, keyboard following and dismissal.
|
|
47
|
+
- [List reordering](https://jolt.rafaelaugusto.dev/guide/reorder): stable keys, native drag snapshots, neighbour springs and edge scrolling through recycled cells.
|
|
48
|
+
- [Shared layouts](https://jolt.rafaelaugusto.dev/guide/shared-layout): stable identities, native snapshots and interruptible transitions within one page.
|
|
49
|
+
- [Shared navigation](https://jolt.rafaelaugusto.dev/guide/shared-navigation) and a [connected gallery](https://jolt.rafaelaugusto.dev/guide/gallery): photo/card transitions, interactive return and current-cell resolution within the documented Frame/ListView combinations.
|
|
50
|
+
- [Interactive iOS navigation](https://jolt.rafaelaugusto.dev/guide/interactive-navigation) and [Android predictive back](https://jolt.rafaelaugusto.dev/guide/predictive-back), with cancellation and guarded route commits.
|
|
51
|
+
- [Native scroll composition](https://jolt.rafaelaugusto.dev/guide/scroll-header): measured collapsing headers, parallax and pinning with a Core ListView adapter.
|
|
52
|
+
- [Device sensors](https://jolt.rafaelaugusto.dev/guide/device-sensors): rotation and gravity sources feeding native motion values and live springs.
|
|
53
|
+
- [Gravity and bounce](https://jolt.rafaelaugusto.dev/guide/gravity) plus [circle physics](https://jolt.rafaelaugusto.dev/guide/circle-physics) with [attachments and snap points](https://jolt.rafaelaugusto.dev/guide/physics-attachments).
|
|
54
|
+
- [Vector drawing and morphing](https://jolt.rafaelaugusto.dev/guide/shapes): animated strokes and compatible path interpolation on iOS and Android.
|
|
55
|
+
- [Animated blur](https://jolt.rafaelaugusto.dev/guide/blur): iOS backdrop materials and Android content blur, with explicit platform limits.
|
|
56
|
+
- [Liquid Glass](https://jolt.rafaelaugusto.dev/guide/glass): native glass containers and surfaces on iOS 26+, ordinary blur on older iOS, and classic layouts on Android.
|
|
57
|
+
- [Interaction replay](https://jolt.rafaelaugusto.dev/guide/interaction-replay): optional development traces and controlled-clock regression checks, including scroll-to-sheet handoff.
|
|
58
|
+
- [Motion inspector](https://jolt.rafaelaugusto.dev/guide/motion-inspector): development-only ownership/timing diagnostics, native observation batches and reproducible spring tuning.
|
|
59
|
+
- [Adaptive curve sampling](https://jolt.rafaelaugusto.dev/guide/transitions): spend native keyframes where they improve precision, within bounded setup budgets.
|
|
60
|
+
- [SceneKit environment and shaders](https://jolt.rafaelaugusto.dev/guide/scene-shaders): native environment intensity and typed scalar/vector shader inputs on iOS.
|
|
61
|
+
- [Layered motion](#layered-motion): several animations on one property, added or multiplied.
|
|
62
|
+
- [Gradients](#gradients): native linear, radial and conic gradients with animated colors, angle, center and radius.
|
|
63
|
+
- [Motion scopes and states](https://jolt.rafaelaugusto.dev/guide/motion-controllers) for component cleanup and coordinated visual states, with a transition per target.
|
|
42
64
|
- [Animated touch targets](https://jolt.rafaelaugusto.dev/guide/interaction-surface) with an opt-in native interaction surface.
|
|
43
65
|
- [Layout changes](https://jolt.rafaelaugusto.dev/guide/layout): insertion, removal, reorder and resize of container children.
|
|
44
|
-
- [
|
|
66
|
+
- [Real dimensions](https://jolt.rafaelaugusto.dev/guide/size): animate width, height and auto with text reflow and moving siblings.
|
|
67
|
+
- [Drag](https://jolt.rafaelaugusto.dev/guide/drag) with bounds, snap points, rubberband and native release physics, moving the view or a motion value.
|
|
45
68
|
- [Decay](#decay) from a release velocity, with optional snap points.
|
|
46
69
|
- [Keyframes and tweens](#tweens) with an easing per segment and exact keyframe times.
|
|
47
70
|
- [Stagger](#several-views) across several views, from the first, the last or the center.
|
|
48
71
|
- [List rows](#list-rows) that play an entrance as they scroll into view, every time or once per item.
|
|
49
72
|
- [Sequences](#sequences) with overlapping arrivals, shared starts and absolute timeline positions.
|
|
73
|
+
- [Controlled timelines](https://jolt.rafaelaugusto.dev/guide/sequences) pause and resume views, motion values and image effects together.
|
|
74
|
+
- [Observable playback progress](https://jolt.rafaelaugusto.dev/guide/playback) feeds native bindings and opt-in subscribers from the original clock.
|
|
75
|
+
- [Native property adapters](https://jolt.rafaelaugusto.dev/guide/native-properties) for maps and SceneKit camera pose/[field of view](https://jolt.rafaelaugusto.dev/guide/scene-camera), lights and solid-color materials, through the optional `@rafaelaugusto/jolt-native` plugin.
|
|
50
76
|
- [Press effects](#press) that follow the finger and let go when a scroll takes over.
|
|
51
77
|
- [Vue directives and a transition component](#vue) from the optional `@rafaelaugusto/jolt/vue` entry.
|
|
52
78
|
- [Text entrances](#text) by letter or word on iOS and Android, preserving the Label’s layout and accessibility.
|
|
@@ -58,14 +84,14 @@ Jolt computes the motion once, in JavaScript, when the animation starts, and han
|
|
|
58
84
|
- [Photo zoom and pan](https://jolt.rafaelaugusto.dev/guide/photo-zoom): native pinch, double tap, bounds and vertical dismissal intents.
|
|
59
85
|
- [Loaders](#loaders) with dots, bars and ring styles on iOS.
|
|
60
86
|
- [Circular reveal](#circular-reveal) to show or hide content from a point on iOS.
|
|
61
|
-
- [Haptics](#haptics) at arrival or at marked points in an animation on iOS.
|
|
62
|
-
- [Particles and confetti](#particles-and-confetti) on iOS.
|
|
87
|
+
- [Haptics](#haptics) at arrival or at marked points in an animation on iOS and Android.
|
|
88
|
+
- [Particles and confetti](#particles-and-confetti) on iOS and Android.
|
|
63
89
|
- [Scroll-linked animations](#scroll-linked-animations) for parallax and collapsing headers.
|
|
64
90
|
- [Keyboard following](#follow-the-keyboard) for composers that rise with the keyboard, at its speed and curve.
|
|
65
91
|
- [Playback controls](#pause-play-and-scrub) to pause, continue and scrub a finite timeline.
|
|
66
92
|
- [Time scale and reduced motion](#time-scale-and-reduced-motion): slow everything down while tuning, and follow the platform's reduced-motion setting by default.
|
|
67
93
|
- [Interruptions](#interrupting-and-stopping) that pick up the value and velocity on screen, with no jump.
|
|
68
|
-
- [Native playback](#how-it-works): Core Animation on iOS
|
|
94
|
+
- [Native playback](#how-it-works): default view tracks run through Core Animation on iOS and `ObjectAnimator` on Android without per-frame JavaScript; layout, input and subscriptions have their own execution costs.
|
|
69
95
|
|
|
70
96
|
## Install
|
|
71
97
|
|
|
@@ -73,7 +99,7 @@ Jolt computes the motion once, in JavaScript, when the animation starts, and han
|
|
|
73
99
|
npm install @rafaelaugusto/jolt@next
|
|
74
100
|
```
|
|
75
101
|
|
|
76
|
-
|
|
102
|
+
The current release candidate is **0.1.0-rc.2**, published under the `next` tag. Requires `@nativescript/core` 8.9 or later. It doesn't depend on a framework: it takes a view, or an element that holds one. Rebuild the native app after installing or upgrading Jolt. See [release status and limits](https://jolt.rafaelaugusto.dev/guide/not-there-yet) for the remaining stable-release acceptance work.
|
|
77
103
|
|
|
78
104
|
On iOS 15+, Jolt requests up to 120 Hz on ProMotion displays. Set `CADisableMinimumFrameDurationOnPhone` to `true` in the app's `App_Resources/iOS/Info.plist` and rebuild to enable higher rates on iPhone. See the [iOS setup](https://jolt.rafaelaugusto.dev/guide/install#promotion-on-ios); the system still chooses the actual refresh rate.
|
|
79
105
|
|
|
@@ -186,6 +212,43 @@ Color strings and NativeScript `Color` objects work as targets or keyframes; `nu
|
|
|
186
212
|
|
|
187
213
|
Android includes a Java animation target; rebuild the native app after installing or upgrading Jolt.
|
|
188
214
|
|
|
215
|
+
## Motion values
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
import { animate, bind, motionValue } from '@rafaelaugusto/jolt'
|
|
219
|
+
|
|
220
|
+
const progress = motionValue(0)
|
|
221
|
+
bind(backdrop, { opacity: progress.to([0, 1], [0, 0.45]) })
|
|
222
|
+
bind(sheet, { y: progress.to([0, 1], [200, 0]) })
|
|
223
|
+
animate(progress, 1, 'snappy')
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
One value drives several properties and views on one native clock, mapped with `to()` like React Native's `interpolate`, to numbers or colors. Interruptions carry the value and its velocity to every bound view, `set()` and `stop()` take a value, and a value outlives its views. `scrollValue(scrollView)` turns a scroll offset into a value that bindings follow, and `drag(view, { axis, value })` writes a gesture and its release into one. In Vue, `useMotionValue()`, `useScrollValue()` and `useBinding()` handle the lifecycle. See the [guide](https://jolt.rafaelaugusto.dev/guide/motion-values).
|
|
227
|
+
|
|
228
|
+
## Layered motion
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
animate(card, { x: 120 }, 'snappy') // the base
|
|
232
|
+
animate(card, 'shake', { layer: 'feedback' }) // on top of it
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
A layer plays next to a property's other animations instead of replacing them: translations and rotations add, scale and opacity multiply. A shake rides on a drag, a pulse keeps breathing while the card moves, and `stop(card, ['x'], { layer: 'feedback' })` takes one layer away. While a property has layers, they play as one composite native track, sampled again only when something changes. See the [guide](https://jolt.rafaelaugusto.dev/guide/layers).
|
|
236
|
+
|
|
237
|
+
## Gradients
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
import { gradient } from '@rafaelaugusto/jolt'
|
|
241
|
+
|
|
242
|
+
const glow = gradient(card, {
|
|
243
|
+
type: 'radial',
|
|
244
|
+
colors: ['#A78BFA', '#0F172A'],
|
|
245
|
+
radius: 0.45,
|
|
246
|
+
})
|
|
247
|
+
glow.animate({ center: { x: 0.7, y: 0.7 }, radius: 0.9 }, { duration: 1400 })
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
Native linear, radial and conic gradients behind a layout's children, which NativeScript's CSS doesn't have beyond a static `linear-gradient`. Colors, stops, angle, center and radius animate with springs, tweens and repeats: a `CAGradientLayer` with Core Animation keyframes on iOS, a native drawable and animator on Android. Pass motion/derived values directly, or use `glow.bind(...)`, to share a source with view properties without a JS observer loop. `motionScope().gradient()` owns lifecycle and suspension, and `v-gradient` supports the same bindings in Vue. Native binding windows are sampled in JS at preparation/control boundaries; gesture updates still enter JS. Rebuild Android after upgrading. See the [guide and native interaction videos](https://jolt.rafaelaugusto.dev/guide/gradients#following-motion-values).
|
|
251
|
+
|
|
189
252
|
## Transitions
|
|
190
253
|
|
|
191
254
|
The third argument says how to get there. Without one, transforms move with a spring and opacity and colors ease over 300ms. Keyframes tween.
|
|
@@ -206,6 +269,8 @@ animate(card, { y: 0 }, { stiffness: 300, damping: 20, mass: 1 })
|
|
|
206
269
|
|
|
207
270
|
`bounce` goes from -1 to 1: 0 settles without overshooting, higher values bounce more, negative values settle more slowly. `duration` is how long the spring feels, the same model as SwiftUI. Or describe it with `stiffness`, `damping` and `mass`. A spring starts with the velocity of the animation it interrupts, unless you pass `velocity` (units per second).
|
|
208
271
|
|
|
272
|
+
Coming from React Native, `origamiSpring({ friction: 7, tension: 40 })` gives the spring `Animated.spring` plays for `friction` and `tension`. See [From React Native Animated](https://jolt.rafaelaugusto.dev/guide/react-native) for the rest of the mapping.
|
|
273
|
+
|
|
209
274
|
### Tweens
|
|
210
275
|
|
|
211
276
|
```ts
|
|
@@ -217,13 +282,32 @@ animate(
|
|
|
217
282
|
)
|
|
218
283
|
```
|
|
219
284
|
|
|
220
|
-
|
|
285
|
+
**A tween takes 300 ms with `easeOut` unless told otherwise.** That's shorter than React Native's `Animated.timing` (500 ms, ease in and out) and starts faster than CSS's `ease`, so pass both when a port has to match.
|
|
286
|
+
|
|
287
|
+
`ease` takes `linear`, `ease`, `easeIn`, `easeOut`, `easeInOut`, `circIn`, `circOut`, `circInOut`, `backIn`, `backOut`, `backInOut`, `anticipate`, the `quad`, `cubic`, `quart`, `quint`, `sine` and `expo` curves with `In`, `Out` or `InOut` (`'cubicOut'`), a cubic bezier (`[0.2, 0, 0, 1]`) or any function from 0..1 to a value. With keyframes, pass one per segment. `times` places each keyframe between 0 and 1.
|
|
288
|
+
|
|
289
|
+
With `easeTrack: true`, one `ease` runs over the whole track instead, and the value moves in straight lines between keyframes, the way React Native's `interpolate` places its output range on an eased value:
|
|
290
|
+
|
|
291
|
+
```ts
|
|
292
|
+
animate(
|
|
293
|
+
spark,
|
|
294
|
+
{ y: [0, -30, -12, 0] },
|
|
295
|
+
{ duration: 900, ease: 'easeOut', easeTrack: true, times: [0, 0.4, 0.7, 1] },
|
|
296
|
+
)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
An easing that overshoots, like `backOut`, extends the first or last segment, as `interpolate` does with `extrapolate: 'extend'`. `easeTrack` takes a single `ease` and applies to tweens only.
|
|
221
300
|
|
|
222
301
|
Custom easing functions run once, when the animation starts, like springs do. They don't cost anything per frame.
|
|
223
302
|
|
|
224
303
|
### Per property
|
|
225
304
|
|
|
226
305
|
```ts
|
|
306
|
+
animate(
|
|
307
|
+
logo,
|
|
308
|
+
{ scale: [0.6, 1.08, 1], opacity: [0, 1, 1] },
|
|
309
|
+
{ duration: 900, ease: 'easeInOut', opacity: { times: [0, 0.3, 1] } },
|
|
310
|
+
)
|
|
227
311
|
animate(
|
|
228
312
|
card,
|
|
229
313
|
{ y: 0, opacity: 1 },
|
|
@@ -231,7 +315,7 @@ animate(
|
|
|
231
315
|
)
|
|
232
316
|
```
|
|
233
317
|
|
|
234
|
-
|
|
318
|
+
Over a tween, a property's transition changes only what it sets: the logo's opacity keeps the 900 ms `easeInOut` and only places its keyframes. Over a spring, or when it is a spring itself, it replaces the curve, so the card's opacity gets a 150 ms tween. Either way, it keeps the timing (`delay`, `repeat`) of the main one unless it sets its own. `times` and per-segment easings taken from the main transition are left out when they don't fit the property's keyframes. Options passed to a [preset](https://jolt.rafaelaugusto.dev/guide/presets) merge the same way, so `animate(card, 'heartbeat', { duration: 1600 })` keeps the beat's rhythm.
|
|
235
319
|
|
|
236
320
|
### Timing
|
|
237
321
|
|
|
@@ -245,6 +329,18 @@ animate(
|
|
|
245
329
|
|
|
246
330
|
`delay` is in milliseconds, and the view takes the first keyframe during it. `repeat` is how many more times to play, `Infinity` until stopped. `repeatType: 'reverse'` plays every other repeat backwards. Repeats play natively too.
|
|
247
331
|
|
|
332
|
+
`repeatDelay` holds the end value for that many milliseconds before each repeat. The first play doesn't wait, and neither does the end of the last one. With `'reverse'` it waits at both ends:
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
animate(
|
|
336
|
+
z,
|
|
337
|
+
{ y: [0, -40], opacity: [0, 1] },
|
|
338
|
+
{ duration: 1200, repeat: Infinity, repeatDelay: 1800 },
|
|
339
|
+
)
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
The wait is part of the native keyframes, so it costs no JavaScript while it plays. Stopping during the wait leaves the view at the held value. A range, `repeatDelay: [1000, 4000]`, draws a new wait before each repeat; an endless loop draws sixteen and loops them natively.
|
|
343
|
+
|
|
248
344
|
## Decay
|
|
249
345
|
|
|
250
346
|
```ts
|
|
@@ -451,7 +547,7 @@ animate(card, { y: 0 }, { type: 'spring', haptic: 'light' })
|
|
|
451
547
|
animate(button, 'bounce', { haptic: { style: 'light', times: [0.6, 1] } })
|
|
452
548
|
```
|
|
453
549
|
|
|
454
|
-
Choose `light`, `medium` or `heavy`. By default, one impact fires when the animation visually arrives. Explicit points can mark each landing of a bounce. Delays and stagger follow the animation; interruptions, stopping and unloading cancel pending feedback. iOS
|
|
550
|
+
Choose `light`, `medium` or `heavy`. By default, one impact fires when the animation visually arrives. Explicit points can mark each landing of a bounce. Delays and stagger follow the animation; interruptions, stopping and unloading cancel pending feedback. Supported on iOS and Android, respecting device settings. See the [haptics guide](https://jolt.rafaelaugusto.dev/guide/haptics) for timing, platform mappings and physical-device behavior.
|
|
455
551
|
|
|
456
552
|
## Particles and confetti
|
|
457
553
|
|
|
@@ -463,7 +559,7 @@ const stopSnow = particles(scene, { source: 'top', angle: 90, velocity: 45 })
|
|
|
463
559
|
stopSnow() // remove the emitter and its particles
|
|
464
560
|
```
|
|
465
561
|
|
|
466
|
-
Confetti bursts into the target's window and cleans itself up. `particles()` adds an emitter
|
|
562
|
+
Confetti bursts into the target's window and cleans itself up. `particles()` adds an emitter for snow, sparks, bubbles or finite effects. Both use native playback without JS simulation/painting per frame: Core Animation on iOS, a bounded Java simulation and Canvas drawable on Android. They respect reduced motion and cancel on unload/backgrounding. Android drawing shares the UI thread; rebuild the app after upgrading. See the [guide and native videos](https://jolt.rafaelaugusto.dev/guide/particles).
|
|
467
563
|
|
|
468
564
|
## Scroll-linked animations
|
|
469
565
|
|
|
@@ -488,7 +584,17 @@ import { followKeyboard } from '@rafaelaugusto/jolt'
|
|
|
488
584
|
const release = followKeyboard(composer)
|
|
489
585
|
```
|
|
490
586
|
|
|
491
|
-
The view rises by exactly the distance the keyboard would cover it, with the keyboard's own duration and curve, and settles back when it hides. On iOS the keyboard notifications drive a `UIView` animation; on Android 11+ a native `WindowInsetsAnimation` callback moves the view on every frame, with and without `adjustResize`. The view's `translateY` is written so later animations start from the position on screen. Rebuild Android after upgrading. See the [guide](https://jolt.rafaelaugusto.dev/guide/keyboard).
|
|
587
|
+
The view rises by exactly the distance the keyboard would cover it, with the keyboard's own duration and curve, and settles back when it hides. On iOS the keyboard notifications drive a `UIView` animation; on Android 11+ a native `WindowInsetsAnimation` callback moves the view on every frame, with and without `adjustResize`. Android 7 to 10 read the keyboard from the window's visible frame and animate the view with the keyboard's measured timing. The view's `translateY` is written so later animations start from the position on screen. Rebuild Android after upgrading. See the [guide](https://jolt.rafaelaugusto.dev/guide/keyboard).
|
|
588
|
+
|
|
589
|
+
To react in other ways, `onKeyboard()` reports how much of the window the keyboard covers, with a transition that moves in step with it:
|
|
590
|
+
|
|
591
|
+
```ts
|
|
592
|
+
const off = onKeyboard(({ visible, transition }) => {
|
|
593
|
+
animate(header, { scale: visible ? 0.8 : 1 }, transition)
|
|
594
|
+
})
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
`useKeyboard()` from `/vue` keeps a ref in sync until unmount.
|
|
492
598
|
|
|
493
599
|
## Pause, play and scrub
|
|
494
600
|
|
|
@@ -512,7 +618,7 @@ configure({ reducedMotion: 'always' }) // transforms jump, opacity still fades
|
|
|
512
618
|
|
|
513
619
|
Tuning a spring at full speed is guesswork. The scale applies to every engine animation started after the call, on iOS and Android alike: durations, delays, stagger, sequence positions and spring time stretch together, keyframes stay dense, and an interruption still picks up the value and velocity on screen. Native loops such as shimmer and loaders keep their own timing.
|
|
514
620
|
|
|
515
|
-
With Reduce Motion on iOS or Remove animations on Android, translations, scale, rotation, paths, decorations and decay jump to their end values while opacity and colors still animate. `'user'` is the default; `'always'` and `'never'` override the platform for the whole library. See the [guide](https://jolt.rafaelaugusto.dev/guide/configure).
|
|
621
|
+
With Reduce Motion on iOS or Remove animations on Android, translations, scale, rotation, paths, decorations and decay jump to their end values while opacity and colors still animate. `'user'` is the default; `'always'` and `'never'` override the platform for the whole library. `reducedMotion()` reads the result, `onReducedMotion(callback)` watches it, and `useReducedMotion()` from `/vue` keeps a ref in sync. See the [guide](https://jolt.rafaelaugusto.dev/guide/configure).
|
|
516
622
|
|
|
517
623
|
## Interrupting and stopping
|
|
518
624
|
|
|
@@ -532,9 +638,17 @@ Selected properties stay at their current values; the others keep animating. `sc
|
|
|
532
638
|
|
|
533
639
|
If part of an animation is stopped, its `finished` promise resolves with `false` once its remaining properties finish.
|
|
534
640
|
|
|
641
|
+
`set()` places a view without animating it, and stops whatever animates those properties:
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
set(logo, { opacity: 1, scale: 1, y: 0 })
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
It takes one value per property, the same properties as `animate()`. The next animation starts from there. See [setting values](https://jolt.rafaelaugusto.dev/guide/interrupting#setting-values-without-animating).
|
|
648
|
+
|
|
535
649
|
## How it works
|
|
536
650
|
|
|
537
|
-
When
|
|
651
|
+
When a sampled animation starts, Jolt resolves its starting values and computes the source curve. Numeric springs, decays and tweens use [adaptive keyframes](https://jolt.rafaelaugusto.dev/guide/transitions#adaptive-keyframes), concentrating detail where linear interpolation needs it. Authored keyframe times stay exact and straight numeric segments keep only their endpoints. Sampling has bounded refinement budgets and a capped uniform fallback. Color mixing, composed motion-value mappings and retained live springs use their own sampling or execution paths.
|
|
538
652
|
|
|
539
653
|
The samples go to the platform in one go:
|
|
540
654
|
|
|
@@ -545,17 +659,21 @@ Solid [colors](#colors) use CGColor keyframes on iOS and int keyframes through a
|
|
|
545
659
|
|
|
546
660
|
Before playing, the final values are set on the NativeScript view, like `view.animate()` does, so `view.translateX` already holds the target while the animation runs. Stopping writes back the values on screen.
|
|
547
661
|
|
|
662
|
+
`animateSize()` performs NativeScript measurement/layout in JavaScript each frame so content can reflow. Opt-in subscribers, gesture input and timeline step activation retain their documented JS costs. `springValue()` uses retained native spring state and shared display callbacks, rather than rebuilding sampled tracks on each target change. See the [execution paths](https://jolt.rafaelaugusto.dev/guide/how-it-works).
|
|
663
|
+
|
|
548
664
|
Native playback does not isolate Android View animations from a blocked UI thread. Main-runtime JavaScript shares that thread, and `withLayer()` only caches drawing. Move suitable CPU work to a Worker and keep view updates small. See the [busy JavaScript guide](https://jolt.rafaelaugusto.dev/guide/android-performance) and [Android diagnostic](./benchmarks/android-busy.md).
|
|
549
665
|
|
|
550
666
|
On Android, opacity animations temporarily cache hardware-accelerated containers with children in a hardware layer. Jolt waits for the fade to start and restores the layer on completion, stop, replacement or unload. Existing app-configured layers are preserved; empty, unmeasured and larger-than-screen containers are skipped. See the [fade-layer benchmark](./benchmarks/android-fade.md) for measurement and memory tradeoffs.
|
|
551
667
|
|
|
552
668
|
Each running property remembers its curve and start time. On Android, interruptions read the displayed value and the animator's current play time, so inherited velocity follows the system's animator duration scale. Early spring arrivals use a native timing marker with completion callbacks only; other sequences advance on native completion. Delays, repeats and disabled animations follow the same platform clock, without JavaScript running per frame.
|
|
553
669
|
|
|
554
|
-
##
|
|
670
|
+
## Release status and limits
|
|
671
|
+
|
|
672
|
+
<a id="not-there-yet"></a>
|
|
673
|
+
|
|
674
|
+
RC.1 already includes [gesture composition and vertical Core ScrollView handoff](https://jolt.rafaelaugusto.dev/guide/gestures), [shared navigation](https://jolt.rafaelaugusto.dev/guide/shared-navigation), the [connected gallery](https://jolt.rafaelaugusto.dev/guide/gallery), [scroll composition](https://jolt.rafaelaugusto.dev/guide/scroll-header) and [rotation/gravity sensors](https://jolt.rafaelaugusto.dev/guide/device-sensors), within their documented platform/container combinations.
|
|
555
675
|
|
|
556
|
-
|
|
557
|
-
- Gesture composition and nested-scroll handoff remain separate work ([#51](https://github.com/rafaelaugustos/jolt/issues/51)).
|
|
558
|
-
- No layout or shared element transitions ([#21](https://github.com/rafaelaugustos/jolt/issues/21), [#24](https://github.com/rafaelaugustos/jolt/issues/24)).
|
|
676
|
+
The 0.1.0 feature scope is frozen. Physical-device acceptance for the gallery ([#117](https://github.com/rafaelaugustos/jolt/issues/117)), scroll composition ([#116](https://github.com/rafaelaugustos/jolt/issues/116)) and sensors ([#114](https://github.com/rafaelaugustos/jolt/issues/114)) remains open. These APIs are shipped; their remaining acceptance checks still matter before stable. Other adapters and broader feature milestones remain later work. See [release status and limits](https://jolt.rafaelaugusto.dev/guide/not-there-yet) for the current scope, execution costs and validation requirements.
|
|
559
677
|
|
|
560
678
|
## API
|
|
561
679
|
|
|
@@ -563,6 +681,8 @@ Each running property remembers its curve and start time. On Android, interrupti
|
|
|
563
681
|
|
|
564
682
|
`animateLayout(container, change?, options?)` animates the next layout of direct children; `motionScope().animateLayout()` owns it through component lifecycle. Cancellation settles temporary offsets into the final layout.
|
|
565
683
|
|
|
684
|
+
`animateSize(view, dimensions, change?, options?)` animates actual width/height/auto in StackLayout/GridLayout, including inside ScrollView. Its `SizeAnimation` supports pause/resume, stop and restoring the original declarations. It runs JS measurement/layout each frame. `motionScope().animateSize()` owns its lifecycle. See the [guide and native videos](https://jolt.rafaelaugusto.dev/guide/size).
|
|
685
|
+
|
|
566
686
|
`interactionSurface(target)` opts a view/subtree into native touch geometry during animation; returns `{ disposed, dispose() }`. Register before playback; rebuild iOS after upgrading.
|
|
567
687
|
|
|
568
688
|
`drag()` returns a controller with `position`, `dragging`, `settling`, `cancel()`, `pause()`, `play()` and `dispose()`. `motionScope().drag()` owns it through component lifecycle.
|
|
@@ -573,9 +693,27 @@ Each running property remembers its curve and start time. On Android, interrupti
|
|
|
573
693
|
|
|
574
694
|
**Helpers**: `definePreset`, `presets`, `springs`, `cubicBezier`, plus the types (`Keyframes`, `Transition`, `Spring`, `Tween`, `Preset`, `Presets`, `PresetName`, `SpringName`, `Easing`, `Animation`, `Target`...).
|
|
575
695
|
|
|
696
|
+
The core also exports [`scrollHeader()`](https://jolt.rafaelaugusto.dev/guide/scroll-header). Optional modules are included in the core package and imported through their own entry points:
|
|
697
|
+
|
|
698
|
+
| Entry point | API and guide |
|
|
699
|
+
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
700
|
+
| `@rafaelaugusto/jolt/gestures` | [`gestures()`, `GestureSurface`](https://jolt.rafaelaugusto.dev/guide/gestures) |
|
|
701
|
+
| `@rafaelaugusto/jolt/shared-navigation` | [`sharedNavigation()`](https://jolt.rafaelaugusto.dev/guide/shared-navigation), [`sharedNavigationEntry()`](https://jolt.rafaelaugusto.dev/guide/shared-gestures), [`resolveListTarget()`](https://jolt.rafaelaugusto.dev/guide/return-targets) |
|
|
702
|
+
| `@rafaelaugusto/jolt/interactive-navigation` | [`interactiveNavigation()`](https://jolt.rafaelaugusto.dev/guide/interactive-navigation) |
|
|
703
|
+
| `@rafaelaugusto/jolt/predictive-back` | [`predictiveBack()`](https://jolt.rafaelaugusto.dev/guide/predictive-back) |
|
|
704
|
+
| `@rafaelaugusto/jolt/sensors` | [`sensor('rotation')`, `sensor('gravity')`](https://jolt.rafaelaugusto.dev/guide/device-sensors) |
|
|
705
|
+
| `@rafaelaugusto/jolt/physics` | [`physicsWorld()`](https://jolt.rafaelaugusto.dev/guide/physics-attachments) |
|
|
706
|
+
| `@rafaelaugusto/jolt/shapes` | [`shape()`](https://jolt.rafaelaugusto.dev/guide/shapes) |
|
|
707
|
+
| `@rafaelaugusto/jolt/blur` | [`blur()`](https://jolt.rafaelaugusto.dev/guide/blur) |
|
|
708
|
+
| `@rafaelaugusto/jolt/glass` | [`GlassContainer`, `GlassView`, `supportsLiquidGlass()`](https://jolt.rafaelaugusto.dev/guide/glass) |
|
|
709
|
+
|
|
710
|
+
External map/SceneKit property adapters additionally require the separate matching `@rafaelaugusto/jolt-native` package. See the [complete API reference](https://jolt.rafaelaugusto.dev/guide/api) for the remaining entries and lifecycle contracts.
|
|
711
|
+
|
|
576
712
|
## Demo
|
|
577
713
|
|
|
578
|
-
[`demo/`](./demo) opens
|
|
714
|
+
[`demo/`](./demo) now opens **Jolt Motion Studio**: a branded animated splash, a moving home, and 74 searchable experiments with category filters and native page navigation through Vue Router NS. The iOS preview includes the Jolt name and icon; launching normally always opens the collection. See the [native walkthrough](./docs/guide/demo.md).
|
|
715
|
+
|
|
716
|
+
The assistant remains available through `--screen=home` on iOS or `--es screen home` on Android: a fan of document tools, a voice screen with letter-by-letter text, and a staged conversation with document previews and a rolling countdown, with the screens cross-fading through the Vue entry. Open **Help → Watch demo** to replay the flow. The orb is an animated illustration; speech, documents and audio are sample data.
|
|
579
717
|
|
|
580
718
|
| Assistant | Presets | Springs | Stagger |
|
|
581
719
|
| :----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
@@ -585,7 +723,11 @@ Each running property remembers its curve and start time. On Android, interrupti
|
|
|
585
723
|
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
586
724
|
| <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-sequences.gif" width="200" alt="Overlapping steps and steps in order"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-press-android.gif" width="200" alt="Three press effects"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-rolling.gif" width="200" alt="Digits rolling up and down"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-text-android.gif" width="200" alt="Letter and word entrances"> |
|
|
587
725
|
|
|
588
|
-
|
|
726
|
+
| Layout (iOS) | Drag and snap (iOS) | Image effects (iOS) | Photo zoom (iOS) |
|
|
727
|
+
| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
|
|
728
|
+
| <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-layout-ios.gif" width="200" alt="Native cards insert, reorder and expand"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-drag-ios.gif" width="200" alt="A card and panel follow real drags and settle within bounds"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-image-effects-ios.gif" width="200" alt="Ripple, touch distortion and dissolve on a raster image"> | <img src="https://raw.githubusercontent.com/rafaelaugustos/jolt/main/.github/assets/demo-photo-zoom-ios.gif" width="200" alt="A photo responds to pinch, pan and double tap"> |
|
|
729
|
+
|
|
730
|
+
The animation playground opens with `--playground` on iOS and `--es playground true` on Android, with presets, interruptible springs, decay, text, press effects, list rows, the keyboard composer and the native iOS helpers. See the [demo guide](./docs/guide/demo.md) for preview arguments and implementation notes. The [documentation](https://jolt.rafaelaugusto.dev) is available in English, Brazilian Portuguese, Spanish and Simplified Chinese. Every visual feature guide embeds reviewed recordings of the real native demo, with captions in the selected language and the recording's platform and limits identified.
|
|
589
731
|
|
|
590
732
|
With the [NativeScript CLI](https://docs.nativescript.org/setup/) installed:
|
|
591
733
|
|
|
@@ -604,8 +746,12 @@ ns run ios # or: ns run android
|
|
|
604
746
|
npm test # unit tests
|
|
605
747
|
npm run typecheck # including the iOS and Android drivers, against the platform typings
|
|
606
748
|
npm run build
|
|
749
|
+
npm run docs:check-media
|
|
750
|
+
npm run docs:build
|
|
607
751
|
```
|
|
608
752
|
|
|
753
|
+
Visual changes require reviewed recordings before completion or release. See [Contributing](./CONTRIBUTING.md).
|
|
754
|
+
|
|
609
755
|
The tests run the engine against a fake platform driver ([`test/helpers.ts`](./test/helpers.ts)) with its own clock: it records the keyframes it would play and ends them when the clock passes their end.
|
|
610
756
|
|
|
611
757
|
For on-device measurements, see the [iOS animation startup benchmark](./benchmarks/README.md).
|
package/dist/animate.d.ts
CHANGED
|
@@ -2,26 +2,47 @@ import type { PlaybackAnimation } from './playback.js';
|
|
|
2
2
|
import { View } from '@nativescript/core';
|
|
3
3
|
import { type Animation } from './engine.js';
|
|
4
4
|
import { type PresetName } from './presets.js';
|
|
5
|
+
import { type MotionValue, type ValueAnimationOptions } from './motion-value.js';
|
|
5
6
|
import { type Property } from './properties.js';
|
|
6
7
|
import { type SpringName } from './transition.js';
|
|
7
|
-
import type { AnimateOptions, DecayOptions, DecayVelocity, Keyframes, KeyframeProperty, Target } from './types.js';
|
|
8
|
+
import type { AnimateOptions, DecayOptions, DecayVelocity, Keyframes, KeyframeProperty, Target, Values } from './types.js';
|
|
8
9
|
/**
|
|
9
10
|
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
10
|
-
* and a transition or the name of a spring.
|
|
11
|
+
* and a transition or the name of a spring. A motion value animates to a number.
|
|
11
12
|
*
|
|
12
13
|
* ```ts
|
|
13
14
|
* animate(card, 'fadeInUp')
|
|
14
15
|
* animate(card, { scale: 1.1, rotate: [0, 90] }, 'bouncy')
|
|
15
16
|
* animate(rows, 'fadeInUp', { stagger: 40 })
|
|
17
|
+
* animate(progress, 1, 'snappy')
|
|
16
18
|
* ```
|
|
17
19
|
*/
|
|
20
|
+
export declare function animate(value: MotionValue, to: number | readonly (number | null)[], transition?: ValueAnimationOptions | SpringName): PlaybackAnimation;
|
|
18
21
|
export declare function animate(target: Target | readonly Target[], animation: Keyframes | PresetName, options?: AnimateOptions | SpringName): PlaybackAnimation;
|
|
19
22
|
/** Validate and snapshot a complete animation before changing any view ownership. */
|
|
20
23
|
export declare function prepareAnimation(target: Target | readonly Target[], animation: Keyframes | PresetName, options?: AnimateOptions | SpringName): () => PlaybackAnimation;
|
|
21
24
|
/** Starts at the current translation and slows down from a velocity in DIPs per second. */
|
|
22
25
|
export declare function decay(target: Target | readonly Target[], velocity: DecayVelocity, options?: DecayOptions): PlaybackAnimation;
|
|
23
|
-
/**
|
|
24
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Stops all or selected properties at their current values. `scale` stops both axes.
|
|
28
|
+
* A motion value stops where it is, and so do the views bound to it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function stop(value: MotionValue, options?: {
|
|
31
|
+
layer?: string;
|
|
32
|
+
}): void;
|
|
33
|
+
export declare function stop(target: Target | readonly Target[], properties?: readonly KeyframeProperty[], options?: {
|
|
34
|
+
layer?: string;
|
|
35
|
+
}): void;
|
|
36
|
+
/**
|
|
37
|
+
* Applies values at once, stopping whatever animates those properties.
|
|
38
|
+
* `scale` sets both axes. A view that isn't loaded yet gets them right away.
|
|
39
|
+
*
|
|
40
|
+
* ```ts
|
|
41
|
+
* set(logo, { opacity: 1, scale: 1, y: 0 })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function set(value: MotionValue, to: number): void;
|
|
45
|
+
export declare function set(target: Target | readonly Target[], values: Values): void;
|
|
25
46
|
/** Plays several animations as one: finished once they all are, and stopped together. */
|
|
26
47
|
export declare function group(animations: readonly Animation[]): Animation;
|
|
27
48
|
export declare function toView(target: Target): View;
|
package/dist/animate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAQzC,OAAO,
|
|
1
|
+
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAQzC,OAAO,EAML,KAAK,SAAS,EAEf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAML,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EAET,gBAAgB,EAEhB,MAAM,EACN,MAAM,EACP,MAAM,YAAY,CAAA;AAWnB;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EACvC,UAAU,CAAC,EAAE,qBAAqB,GAAG,UAAU,GAC9C,iBAAiB,CAAA;AACpB,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,GACpC,iBAAiB,CAAA;AAkBpB,qFAAqF;AACrF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,GACpC,MAAM,iBAAiB,CAoDzB;AAED,2FAA2F;AAC3F,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE,YAAiB,GACzB,iBAAiB,CAkEnB;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAA;AAC5E,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,CAAC,EAAE,SAAS,gBAAgB,EAAE,EACxC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,IAAI,CAAA;AAoBP;;;;;;;GAOG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;AACzD,wBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;AAqB7E,yFAAyF;AACzF,wBAAgB,KAAK,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAWjE;AAED,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAO3C;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,EAAE,CAElE;AA6HD,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,gCAYtC;AAED,wGAAwG;AACxG,wBAAgB,YAAY,CAC1B,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,gCActC"}
|
package/dist/animate.js
CHANGED
|
@@ -4,27 +4,21 @@ import { preparePath } from './path.js';
|
|
|
4
4
|
import { View } from '@nativescript/core';
|
|
5
5
|
import { isColorProperty, parseColor, validateColorTarget, } from './color.js';
|
|
6
6
|
import { DEFAULT_FRICTION, solveDecay } from './decay.js';
|
|
7
|
-
import { arrivalOf, setArrival, stopView, ViewAnimation, } from './engine.js';
|
|
7
|
+
import { arrivalOf, setArrival, stopLayer, stopView, ViewAnimation, } from './engine.js';
|
|
8
8
|
import { getPreset } from './presets.js';
|
|
9
|
+
import { asRoot, detachBindings, isMotionValue, } from './motion-value.js';
|
|
9
10
|
import { resolveHaptic } from './haptics.js';
|
|
11
|
+
import { layerable } from './mixer.js';
|
|
10
12
|
import { isProperty, precision } from './properties.js';
|
|
11
|
-
import { hasCurve, mergeTransitions, resolveTransition, springs, } from './transition.js';
|
|
12
|
-
/**
|
|
13
|
-
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
14
|
-
* and a transition or the name of a spring.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* animate(card, 'fadeInUp')
|
|
18
|
-
* animate(card, { scale: 1.1, rotate: [0, 90] }, 'bouncy')
|
|
19
|
-
* animate(rows, 'fadeInUp', { stagger: 40 })
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
13
|
+
import { hasCurve, fitTransition, mergeTransitions, resolveTransition, springs, } from './transition.js';
|
|
22
14
|
export function animate(target, animation, options) {
|
|
15
|
+
if (isMotionValue(target))
|
|
16
|
+
return asRoot(target).animate(animation, options);
|
|
23
17
|
return prepareAnimation(target, animation, options)();
|
|
24
18
|
}
|
|
25
19
|
/** Validate and snapshot a complete animation before changing any view ownership. */
|
|
26
20
|
export function prepareAnimation(target, animation, options) {
|
|
27
|
-
const { keyframes, base, overrides, stagger, relative, haptic, path } = prepare(animation, options);
|
|
21
|
+
const { keyframes, base, overrides, stagger, relative, haptic, path, layer } = prepare(animation, options);
|
|
28
22
|
const feedback = resolveHaptic(haptic);
|
|
29
23
|
if (!isList(target)) {
|
|
30
24
|
const view = toView(target);
|
|
@@ -33,8 +27,12 @@ export function prepareAnimation(target, animation, options) {
|
|
|
33
27
|
validateColorTarget(view, property);
|
|
34
28
|
else if (isDecorationProperty(property))
|
|
35
29
|
validateDecorationTarget(view, property);
|
|
36
|
-
const plans = plan(keyframes, base, overrides, 0, relative, path);
|
|
37
|
-
return () =>
|
|
30
|
+
const plans = plan(keyframes, base, overrides, 0, relative, path, layer);
|
|
31
|
+
return () => {
|
|
32
|
+
if (layer === undefined)
|
|
33
|
+
detachBindings(view, plans.map(({ property }) => property));
|
|
34
|
+
return new ViewAnimation(view, plans, feedback);
|
|
35
|
+
};
|
|
38
36
|
}
|
|
39
37
|
const views = target.map(toView);
|
|
40
38
|
for (const view of views)
|
|
@@ -43,8 +41,13 @@ export function prepareAnimation(target, animation, options) {
|
|
|
43
41
|
validateColorTarget(view, property);
|
|
44
42
|
else if (isDecorationProperty(property))
|
|
45
43
|
validateDecorationTarget(view, property);
|
|
46
|
-
const
|
|
47
|
-
|
|
44
|
+
const seed = Math.random();
|
|
45
|
+
const plans = views.map((_, index) => plan(keyframes, base, overrides, staggerDelay(stagger, index, views.length), relative, path, layer, seed));
|
|
46
|
+
return () => playbackGroup(views.map((view, index) => {
|
|
47
|
+
if (layer === undefined)
|
|
48
|
+
detachBindings(view, plans[index].map(({ property }) => property));
|
|
49
|
+
return new ViewAnimation(view, plans[index], feedback, true);
|
|
50
|
+
}));
|
|
48
51
|
}
|
|
49
52
|
/** Starts at the current translation and slows down from a velocity in DIPs per second. */
|
|
50
53
|
export function decay(target, velocity, options = {}) {
|
|
@@ -109,11 +112,34 @@ export function decay(target, velocity, options = {}) {
|
|
|
109
112
|
return playbackGroup([]);
|
|
110
113
|
return playbackGroup(views.map((view) => new ViewAnimation(view, plans, undefined, true)));
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
export function stop(target, properties, options) {
|
|
116
|
+
if (isMotionValue(target))
|
|
117
|
+
return asRoot(target).stop(properties?.layer);
|
|
118
|
+
if (properties && !Array.isArray(properties))
|
|
119
|
+
throw new TypeError('View properties must be an array.');
|
|
114
120
|
const expanded = properties?.flatMap((property) => property === 'scale' ? ['scaleX', 'scaleY'] : [property]);
|
|
115
121
|
for (const view of toViews(target))
|
|
116
|
-
|
|
122
|
+
if (options?.layer !== undefined)
|
|
123
|
+
stopLayer(view, options.layer, expanded);
|
|
124
|
+
else
|
|
125
|
+
stopView(view, expanded);
|
|
126
|
+
}
|
|
127
|
+
export function set(target, values) {
|
|
128
|
+
if (isMotionValue(target))
|
|
129
|
+
return asRoot(target).set(values);
|
|
130
|
+
if (values === null || typeof values !== 'object' || Array.isArray(values))
|
|
131
|
+
throw new TypeError('set() takes an object of values.');
|
|
132
|
+
const keyframes = {};
|
|
133
|
+
for (const [key, value] of Object.entries(values)) {
|
|
134
|
+
if (value === undefined)
|
|
135
|
+
continue;
|
|
136
|
+
if (key !== 'scale' && !isProperty(key))
|
|
137
|
+
throw new Error(`Can't set "${key}".`);
|
|
138
|
+
if (value === null || Array.isArray(value))
|
|
139
|
+
throw new TypeError(`set() takes one value per property, got ${String(value)} for "${key}".`);
|
|
140
|
+
keyframes[key] = [value, value];
|
|
141
|
+
}
|
|
142
|
+
animate(target, keyframes, { duration: 0 });
|
|
117
143
|
}
|
|
118
144
|
/** Plays several animations as one: finished once they all are, and stopped together. */
|
|
119
145
|
export function group(animations) {
|
|
@@ -163,6 +189,7 @@ function resolveAnimation(animation, options) {
|
|
|
163
189
|
stagger: user.stagger ?? own.stagger,
|
|
164
190
|
relative: user.relative ?? own.relative,
|
|
165
191
|
haptic: user.haptic ?? own.haptic,
|
|
192
|
+
layer: user.layer,
|
|
166
193
|
};
|
|
167
194
|
}
|
|
168
195
|
function normalize(options) {
|
|
@@ -187,10 +214,16 @@ function normalize(options) {
|
|
|
187
214
|
let stagger;
|
|
188
215
|
let relative;
|
|
189
216
|
let haptic;
|
|
217
|
+
let layer;
|
|
190
218
|
for (const [key, value] of Object.entries(options)) {
|
|
191
219
|
if (value === undefined)
|
|
192
220
|
continue;
|
|
193
|
-
if (key === '
|
|
221
|
+
if (key === 'layer') {
|
|
222
|
+
if (typeof value !== 'string' || !value)
|
|
223
|
+
throw new TypeError('A layer is named by a nonempty string.');
|
|
224
|
+
layer = value;
|
|
225
|
+
}
|
|
226
|
+
else if (key === 'stagger')
|
|
194
227
|
stagger = value;
|
|
195
228
|
else if (key === 'relative')
|
|
196
229
|
relative = value;
|
|
@@ -202,10 +235,14 @@ function normalize(options) {
|
|
|
202
235
|
else
|
|
203
236
|
base[key] = value;
|
|
204
237
|
}
|
|
205
|
-
return { base, overrides, stagger, relative, haptic };
|
|
238
|
+
return { base, overrides, stagger, relative, haptic, layer };
|
|
206
239
|
}
|
|
207
|
-
function plan(keyframes, base, overrides, offset, relative = false, path) {
|
|
240
|
+
function plan(keyframes, base, overrides, offset, relative = false, path, layer, seed = Math.random()) {
|
|
241
|
+
if (layer !== undefined && path)
|
|
242
|
+
throw new Error("A path owns x and y; it can't play on a layer.");
|
|
208
243
|
return expand(keyframes, path).map(([property, frames]) => {
|
|
244
|
+
if (layer !== undefined && !layerable(property))
|
|
245
|
+
throw new Error(`Layers apply to x, y, scale, rotation and opacity; "${property}" has a single owner.`);
|
|
209
246
|
if (path?.properties.includes(property)) {
|
|
210
247
|
if (!Number.isFinite(path.transition.delay + offset) ||
|
|
211
248
|
path.transition.delay + offset < 0)
|
|
@@ -219,16 +256,20 @@ function plan(keyframes, base, overrides, offset, relative = false, path) {
|
|
|
219
256
|
};
|
|
220
257
|
}
|
|
221
258
|
const override = overrides[property] ?? (property.startsWith('scale') ? overrides.scale : undefined);
|
|
222
|
-
const transition = resolveTransition(override ? mergeTransitions(base, override) : base, property, frames.length);
|
|
259
|
+
const transition = resolveTransition(fitTransition(override ? mergeTransitions(base, override) : base, frames.length), property, frames.length);
|
|
223
260
|
transition.delay += offset;
|
|
224
|
-
|
|
261
|
+
if (transition.seed !== undefined)
|
|
262
|
+
transition.seed = seed;
|
|
263
|
+
return { property, keyframes: frames, transition, relative, layer };
|
|
225
264
|
});
|
|
226
265
|
}
|
|
227
266
|
/** Each property the animation touches, with the value it starts from when it sets one. */
|
|
228
267
|
export function startingValues(animation, options) {
|
|
229
|
-
const { keyframes, relative, path } = prepare(animation, options);
|
|
268
|
+
const { keyframes, relative, path, layer } = prepare(animation, options);
|
|
230
269
|
if (!keyframes)
|
|
231
270
|
throw new Error(`Unknown preset "${animation}".`);
|
|
271
|
+
if (layer !== undefined)
|
|
272
|
+
return new Map(expand(keyframes, path).map(([property]) => [property, null]));
|
|
232
273
|
return new Map(expand(keyframes, path).map(([property, [first]]) => [
|
|
233
274
|
property,
|
|
234
275
|
relative && !isColorProperty(property) ? null : first,
|