@rafaelaugusto/jolt 0.1.0-beta.2 → 0.1.0-beta.4
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 +112 -16
- package/dist/animate.d.ts +3 -1
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +89 -3
- package/dist/animate.js.map +1 -1
- package/dist/color.d.ts +11 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +73 -0
- package/dist/color.js.map +1 -0
- package/dist/decay.d.ts +11 -0
- package/dist/decay.d.ts.map +1 -0
- package/dist/decay.js +22 -0
- package/dist/decay.js.map +1 -0
- package/dist/driver/android-color.d.ts +17 -0
- package/dist/driver/android-color.d.ts.map +1 -0
- package/dist/driver/android-color.js +134 -0
- package/dist/driver/android-color.js.map +1 -0
- package/dist/driver/android.d.ts +1 -1
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +101 -5
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/index.d.ts +4 -2
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios-color.d.ts +14 -0
- package/dist/driver/ios-color.d.ts.map +1 -0
- package/dist/driver/ios-color.js +381 -0
- package/dist/driver/ios-color.js.map +1 -0
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +9 -1
- package/dist/driver/ios.js.map +1 -1
- package/dist/engine.d.ts +1 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +15 -8
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/liquid-grid.d.ts +3 -0
- package/dist/liquid-grid.d.ts.map +1 -0
- package/dist/liquid-grid.js +24 -0
- package/dist/liquid-grid.js.map +1 -0
- package/dist/liquid.d.ts +18 -0
- package/dist/liquid.d.ts.map +1 -0
- package/dist/liquid.js +229 -0
- package/dist/liquid.js.map +1 -0
- package/dist/loader.d.ts +19 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +172 -0
- package/dist/loader.js.map +1 -0
- package/dist/press.d.ts.map +1 -1
- package/dist/press.js +6 -1
- package/dist/press.js.map +1 -1
- package/dist/properties.d.ts +5 -3
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +13 -2
- package/dist/properties.js.map +1 -1
- package/dist/reveal.d.ts +25 -0
- package/dist/reveal.d.ts.map +1 -0
- package/dist/reveal.js +293 -0
- package/dist/reveal.js.map +1 -0
- package/dist/text-layout.d.ts +22 -0
- package/dist/text-layout.d.ts.map +1 -0
- package/dist/text-layout.js +179 -0
- package/dist/text-layout.js.map +1 -0
- package/dist/text.d.ts +17 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +267 -0
- package/dist/text.js.map +1 -0
- package/dist/track.d.ts +1 -1
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +63 -5
- package/dist/track.js.map +1 -1
- package/dist/transition.d.ts +5 -0
- package/dist/transition.d.ts.map +1 -1
- package/dist/transition.js +8 -2
- package/dist/transition.js.map +1 -1
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -2
- package/platforms/android/include.gradle +7 -0
- package/platforms/android/java/org/rafaelaugusto/jolt/ColorTarget.java +102 -0
- package/platforms/android/proguard-rules.pro +6 -0
- package/src/animate.ts +105 -5
- package/src/color.ts +101 -0
- package/src/decay.ts +45 -0
- package/src/driver/android-color.ts +168 -0
- package/src/driver/android.ts +120 -10
- package/src/driver/index.ts +9 -2
- package/src/driver/ios-color.ts +432 -0
- package/src/driver/ios.ts +13 -3
- package/src/engine.ts +17 -9
- package/src/index.ts +10 -1
- package/src/liquid-grid.ts +28 -0
- package/src/liquid.ts +282 -0
- package/src/loader.ts +201 -0
- package/src/press.ts +8 -2
- package/src/properties.ts +16 -6
- package/src/reveal.ts +374 -0
- package/src/text-layout.ts +216 -0
- package/src/text.ts +298 -0
- package/src/track.ts +105 -5
- package/src/transition.ts +16 -2
- package/src/types.ts +18 -0
package/README.md
CHANGED
|
@@ -35,12 +35,18 @@ Jolt computes the motion once, in JavaScript, when the animation starts, and han
|
|
|
35
35
|
|
|
36
36
|
- [25 presets](#presets) to enter, exit and draw attention: `fadeInUp`, `popIn`, `shake`, `heartbeat`...
|
|
37
37
|
- [Springs](#springs) described by feel (`bouncy`), by `bounce` and `duration`, or by stiffness, damping and mass.
|
|
38
|
+
- [Colors](#colors) for backgrounds, borders and text, interpolated in OKLab on iOS and Android.
|
|
39
|
+
- [Decay](#decay) from a release velocity, with optional snap points.
|
|
38
40
|
- [Keyframes and tweens](#tweens) with an easing per segment and exact keyframe times.
|
|
39
41
|
- [Stagger](#several-views) across several views, from the first, the last or the center.
|
|
40
42
|
- [Sequences](#sequences) that start each step once the previous one looks done.
|
|
41
43
|
- [Press effects](#press) that follow the finger and let go when a scroll takes over.
|
|
44
|
+
- [Text entrances](#text) by letter or word on iOS, preserving the Label’s layout and accessibility.
|
|
42
45
|
- [SF Symbol effects](#sf-symbols) and animated icon replacement on iOS 17+.
|
|
43
46
|
- [Shimmer](#shimmer) for loading placeholders on iOS.
|
|
47
|
+
- [Liquid images](#liquid-images) with native texture deformation on iOS.
|
|
48
|
+
- [Loaders](#loaders) with dots, bars and ring styles on iOS.
|
|
49
|
+
- [Circular reveal](#circular-reveal) to show or hide content from a point on iOS.
|
|
44
50
|
- [Haptics](#haptics) at arrival or at marked points in an animation on iOS.
|
|
45
51
|
- [Particles and confetti](#particles-and-confetti) on iOS.
|
|
46
52
|
- [Interruptions](#interrupting-and-stopping) that pick up the value and velocity on screen, with no jump.
|
|
@@ -64,14 +70,17 @@ On iOS 15+, Jolt requests up to 120 Hz on ProMotion displays. Set `CADisableMini
|
|
|
64
70
|
animate(card, { opacity: 0.5, y: -20 })
|
|
65
71
|
```
|
|
66
72
|
|
|
67
|
-
| Property
|
|
68
|
-
|
|
|
69
|
-
| `opacity`
|
|
70
|
-
| `x`, `y`
|
|
71
|
-
| `scale`
|
|
72
|
-
| `scaleX`, `scaleY`
|
|
73
|
-
| `rotate`
|
|
74
|
-
| `rotateX`, `rotateY`
|
|
73
|
+
| Property | Unit |
|
|
74
|
+
| ----------------------------------------- | ---------------------------------------- |
|
|
75
|
+
| `opacity` | |
|
|
76
|
+
| `x`, `y` | DIPs, same as `translateX`, `translateY` |
|
|
77
|
+
| `scale` | sets `scaleX` and `scaleY` together |
|
|
78
|
+
| `scaleX`, `scaleY` | |
|
|
79
|
+
| `rotate` | degrees |
|
|
80
|
+
| `rotateX`, `rotateY` | degrees, with perspective |
|
|
81
|
+
| `backgroundColor`, `borderColor`, `color` | NativeScript color string or `Color` |
|
|
82
|
+
|
|
83
|
+
3D rotations and flip presets use the view's `perspective` on both platforms (NativeScript defaults to 1000 DIPs). Set `card.perspective = 600` for stronger depth. Android applies the display density when configuring its camera distance; it keeps the perspective when a rotation ends or stops at an angle.
|
|
75
84
|
|
|
76
85
|
A single value animates from wherever the view is. An array is a list of keyframes, and `null` stands for the current value:
|
|
77
86
|
|
|
@@ -104,9 +113,29 @@ const open = () => animate(card.value, 'popIn')
|
|
|
104
113
|
|
|
105
114
|
A view that isn't loaded yet takes its first absolute keyframe right away and plays once it's on screen. Calling `animate(title, 'fadeInUp')` in `onMounted` doesn't flash the title before it fades in. Relative animations leave the view's values alone until it loads.
|
|
106
115
|
|
|
116
|
+
## Colors
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
animate(
|
|
120
|
+
card,
|
|
121
|
+
{
|
|
122
|
+
backgroundColor: '#263b27',
|
|
123
|
+
borderColor: ['#b6ee64', '#e5a1ff'],
|
|
124
|
+
color: '#f4caff',
|
|
125
|
+
},
|
|
126
|
+
{ duration: 800 },
|
|
127
|
+
)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Color strings and NativeScript `Color` objects work as targets or keyframes; `null` starts from the visible color. Colors interpolate in premultiplied OKLab and stay absolute with `relative: true`. Interruptions, repeats and `stop(card, ['backgroundColor'])` use the same API as transforms. Colors default to a 300 ms tween.
|
|
131
|
+
|
|
132
|
+
`borderColor` requires the same starting color on every edge; widths and corner radii may differ. Text color supports Label and Button on iOS, and TextBase on Android. Explicit formatted-span colors stay intact. On iOS, text uses a native alpha-mask layer preserving UILabel's layout; emoji, attachments, text shadows and masks above four million pixels keep the final model color and resolve `false`. Edits, restyling and unloading cancel text playback and restore the current text. Gradients and images themselves are not interpolated. iOS background-color playback on an image background is skipped to preserve Core’s rasterized image; the final model color is applied. See the [color guide](https://jolt.rafaelaugusto.dev/guide/colors).
|
|
133
|
+
|
|
134
|
+
Android includes a Java animation target; rebuild the native app after installing or upgrading Jolt.
|
|
135
|
+
|
|
107
136
|
## Transitions
|
|
108
137
|
|
|
109
|
-
The third argument says how to get there. Without one, transforms move with a spring and
|
|
138
|
+
The third argument says how to get there. Without one, transforms move with a spring and opacity and colors ease over 300ms. Keyframes tween.
|
|
110
139
|
|
|
111
140
|
### Springs
|
|
112
141
|
|
|
@@ -163,6 +192,19 @@ animate(
|
|
|
163
192
|
|
|
164
193
|
`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.
|
|
165
194
|
|
|
195
|
+
## Decay
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { decay } from '@rafaelaugusto/jolt'
|
|
199
|
+
|
|
200
|
+
decay(card, { x: 600 }) // DIPs per second
|
|
201
|
+
decay(card, { x: 600 }, { friction: 0.998, snap: [0, 320] })
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Starts from the current translation and slows down exponentially. `friction` multiplies velocity per millisecond; smaller values stop sooner. `snap` projects the landing and springs directly to the closest stop, preserving the supplied velocity. Use `{ snap: { x: [0, 320], y: [-200, 0] } }` for independent axes.
|
|
205
|
+
|
|
206
|
+
Shares interruption, `stop()` and awaitable completion with `animate()`. Both platforms use native keyframes with no JavaScript per frame. See the [decay guide](https://jolt.rafaelaugusto.dev/guide/decay).
|
|
207
|
+
|
|
166
208
|
## Presets
|
|
167
209
|
|
|
168
210
|
```ts
|
|
@@ -271,6 +313,52 @@ stopShimmer() // when the content is ready
|
|
|
271
313
|
|
|
272
314
|
A native gradient mask sweeps across the placeholder and its children. It follows layout changes, preserves existing masks and releases native resources while the view is unloaded, resuming on load. Reduce Motion keeps the placeholder static. iOS only for now; Android calls return a no-op cleanup function. See the [shimmer guide](https://jolt.rafaelaugusto.dev/guide/shimmer).
|
|
273
315
|
|
|
316
|
+
## Liquid images
|
|
317
|
+
|
|
318
|
+
```ts
|
|
319
|
+
import { liquid } from '@rafaelaugusto/jolt'
|
|
320
|
+
|
|
321
|
+
const flow = liquid(orb, { intensity: 0.9, duration: 7200 })
|
|
322
|
+
flow.pause()
|
|
323
|
+
flow.resume()
|
|
324
|
+
flow.stop()
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Parts of the image move relative to each other through a native repeating texture warp. Transparency and stretch are preserved; pause freezes the current shape and stop restores the original image. Reduce Motion keeps the image static. iOS only; Android returns an inert handle. See the [liquid image guide](https://jolt.rafaelaugusto.dev/guide/liquid).
|
|
328
|
+
|
|
329
|
+
## Loaders
|
|
330
|
+
|
|
331
|
+
```ts
|
|
332
|
+
import { loader } from '@rafaelaugusto/jolt'
|
|
333
|
+
|
|
334
|
+
const stopLoading = loader(slot, { style: 'dots', color: '#71717a', size: 48 })
|
|
335
|
+
stopLoading() // when the content is ready
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Choose `dots`, `bars` or `ring`. Each indicator uses one native animation replicated across a layer, fits inside its target and stays centered as the target resizes. Reduce Motion shows a static indicator. Unloading releases native resources; loading resumes until explicitly stopped. iOS only for now. See the [loaders guide](https://jolt.rafaelaugusto.dev/guide/loaders).
|
|
339
|
+
|
|
340
|
+
## Circular reveal
|
|
341
|
+
|
|
342
|
+
```ts
|
|
343
|
+
import { reveal, conceal } from '@rafaelaugusto/jolt'
|
|
344
|
+
|
|
345
|
+
await reveal(details, { from: { x: 40, y: 40 }, duration: 500 })
|
|
346
|
+
await conceal(details, { to: { x: 40, y: 40 } })
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
A native circle reveals the view's content or contracts to hide it. Reversing continues from the circle on screen. Existing masks are restored when the effect ends; conceal finishes with `visibility = 'hidden'`, preserving layout space. Reduce Motion applies the final visibility immediately. iOS only for now. See the [circular reveal guide](https://jolt.rafaelaugusto.dev/guide/reveal) for cancellation and layout behavior.
|
|
350
|
+
|
|
351
|
+
## Text
|
|
352
|
+
|
|
353
|
+
```ts
|
|
354
|
+
import { animateText } from '@rafaelaugusto/jolt'
|
|
355
|
+
|
|
356
|
+
await animateText(title)
|
|
357
|
+
await animateText(title, { by: 'word', stagger: 100 })
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
Reveal an iOS Label letter by letter or a word at a time. TextKit keeps the complete text layout, including wrapped lines, attributed styles and composed emoji. Core Animation plays temporary glyph images while the original Label remains the single accessibility element. Stop restores the full text; Reduce Motion skips the entrance. See the [text guide](https://jolt.rafaelaugusto.dev/guide/text) for options and limits.
|
|
361
|
+
|
|
274
362
|
## Haptics
|
|
275
363
|
|
|
276
364
|
```ts
|
|
@@ -312,34 +400,42 @@ If part of an animation is stopped, its `finished` promise resolves with `false`
|
|
|
312
400
|
|
|
313
401
|
## How it works
|
|
314
402
|
|
|
315
|
-
When an animation starts, Jolt resolves where each property starts from (the value on screen, or the keyframes you gave), and computes the whole curve: easing, keyframes, spring physics. It samples the curve 60 times per second of motion, and keeps keyframe times exact. Linear segments
|
|
403
|
+
When an animation starts, Jolt resolves where each property starts from (the value on screen, or the keyframes you gave), and computes the whole curve: easing, keyframes, spring physics and exponential decay. It samples the curve 60 times per second of motion, and keeps keyframe times exact. Linear numeric segments use only their endpoints. Long tween segments and free decays cap sampling at 6,001 keyframes. Color tracks add intermediate OKLab samples even with linear timing.
|
|
316
404
|
|
|
317
405
|
The samples go to the platform in one go:
|
|
318
406
|
|
|
319
407
|
- **iOS**: a `CAKeyframeAnimation` per property on the view's layer (`opacity`, `transform.translation.x`, `transform.scale.y`, `transform.rotation.z`...). Core Animation composes them, so `x` and `scale` can belong to different animations, and plays them in the render server.
|
|
320
408
|
- **Android**: an `ObjectAnimator` per property with `Keyframe`s and a linear interpolator, on the view's `alpha`, `translationX`, `scaleY`, `rotation`...
|
|
321
409
|
|
|
410
|
+
Solid [colors](#colors) use CGColor keyframes on iOS and int keyframes through a native Java target on Android. iOS text uses a UILabel alpha mask so glyph positions stay fixed while the color layer animates.
|
|
411
|
+
|
|
322
412
|
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.
|
|
323
413
|
|
|
324
|
-
|
|
414
|
+
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.
|
|
415
|
+
|
|
416
|
+
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.
|
|
325
417
|
|
|
326
418
|
## Not there yet
|
|
327
419
|
|
|
328
|
-
- `animate()` covers transforms and
|
|
329
|
-
-
|
|
420
|
+
- `animate()` covers transforms, opacity and solid colors. Border widths, corner radii and shadows ([#13](https://github.com/rafaelaugustos/jolt/issues/13)), size and layout changes ([#21](https://github.com/rafaelaugustos/jolt/issues/21)) aren't animated yet.
|
|
421
|
+
- Gesture tracking and drag constraints are next ([#23](https://github.com/rafaelaugustos/jolt/issues/23)); `decay()` supplies the motion after release.
|
|
330
422
|
- No layout or shared element transitions ([#21](https://github.com/rafaelaugustos/jolt/issues/21), [#24](https://github.com/rafaelaugustos/jolt/issues/24)).
|
|
331
423
|
|
|
332
424
|
## API
|
|
333
425
|
|
|
334
|
-
**Animating**: `animate(target, keyframes | preset, transition?)`, `stop(target, properties?)`, `sequence(steps)`, `press(target, pressed?, transition?)`, `symbolEffect(image, effect, options?)`, `shimmer(target, options?)`, `confetti(target, options?)`, `particles(target, options?)`.
|
|
426
|
+
**Animating**: `animate(target, keyframes | preset, transition?)`, `decay(target, velocity, options?)`, `stop(target, properties?)`, `sequence(steps)`, `press(target, pressed?, transition?)`, `symbolEffect(image, effect, options?)`, `shimmer(target, options?)`, `liquid(image, options?)`, `loader(target, options?)`, `reveal(target, options?)`, `conceal(target, options?)`, `confetti(target, options?)`, `particles(target, options?)`.
|
|
335
427
|
|
|
336
|
-
|
|
428
|
+
`liquid()` returns a `LiquidEffect` with `pause()`, `resume()` and `stop()`.
|
|
429
|
+
|
|
430
|
+
**Animations** from `animate()`, `decay()`, `sequence()`, `symbolEffect()`, `reveal()` and `conceal()`: `await`, `finished`, `stop()`. `press()`, `shimmer()`, `loader()`, `confetti()` and `particles()` return cleanup functions.
|
|
337
431
|
|
|
338
432
|
**Helpers**: `definePreset`, `presets`, `springs`, `cubicBezier`, plus the types (`Keyframes`, `Transition`, `Spring`, `Tween`, `Preset`, `Presets`, `PresetName`, `SpringName`, `Easing`, `Animation`, `Target`...).
|
|
339
433
|
|
|
340
434
|
## Demo
|
|
341
435
|
|
|
342
|
-
[`demo/`](./demo)
|
|
436
|
+
[`demo/`](./demo) opens an interactive assistant on iOS: a fan of document tools, a voice screen with letter-by-letter text, and a staged conversation with document previews. Open **Help → Watch demo** to replay the flow. The orb is an animated illustration; speech, documents and audio are sample data.
|
|
437
|
+
|
|
438
|
+
Android opens the animation playground. The same playground is available on iOS with `--playground`, including presets, interruptible springs, decay, text, press effects and the native iOS helpers. See the [demo guide](./docs/guide/demo.md) for preview arguments and implementation notes.
|
|
343
439
|
|
|
344
440
|
With the [NativeScript CLI](https://docs.nativescript.org/setup/) installed:
|
|
345
441
|
|
package/dist/animate.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Animation } from './engine.js';
|
|
|
3
3
|
import { type PresetName } from './presets.js';
|
|
4
4
|
import { type Property } from './properties.js';
|
|
5
5
|
import { type SpringName } from './transition.js';
|
|
6
|
-
import type { AnimateOptions, Keyframes, Target } from './types.js';
|
|
6
|
+
import type { AnimateOptions, DecayOptions, DecayVelocity, Keyframes, Target } from './types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
9
9
|
* and a transition or the name of a spring.
|
|
@@ -15,6 +15,8 @@ import type { AnimateOptions, Keyframes, Target } from './types.js';
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export declare function animate(target: Target | readonly Target[], animation: Keyframes | PresetName, options?: AnimateOptions | SpringName): Animation;
|
|
18
|
+
/** Starts at the current translation and slows down from a velocity in DIPs per second. */
|
|
19
|
+
export declare function decay(target: Target | readonly Target[], velocity: DecayVelocity, options?: DecayOptions): Animation;
|
|
18
20
|
/** Stops all or selected properties at their current values. `scale` stops both axes. */
|
|
19
21
|
export declare function stop(target: Target | readonly Target[], properties?: readonly (keyof Keyframes)[]): void;
|
|
20
22
|
/** Plays several animations as one: finished once they all are, and stopped together. */
|
package/dist/animate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"animate.d.ts","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAQzC,OAAO,EAKL,KAAK,SAAS,EAEf,MAAM,aAAa,CAAA;AACpB,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzD,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAA;AACxB,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EAGT,MAAM,EACP,MAAM,YAAY,CAAA;AAUnB;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,GACpC,SAAS,CAsCX;AAED,2FAA2F;AAC3F,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE,YAAiB,GACzB,SAAS,CAgEX;AAED,yFAAyF;AACzF,wBAAgB,IAAI,CAClB,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,EAClC,UAAU,CAAC,EAAE,SAAS,CAAC,MAAM,SAAS,CAAC,EAAE,QAM1C;AAED,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;AAkFD,2FAA2F;AAC3F,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,GAAG,UAAU,EACjC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,gCAUtC"}
|
package/dist/animate.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { View } from '@nativescript/core';
|
|
2
|
+
import { isColorProperty, parseColor, validateColorTarget, } from './color.js';
|
|
3
|
+
import { DEFAULT_FRICTION, solveDecay } from './decay.js';
|
|
2
4
|
import { arrivalOf, setArrival, stopView, ViewAnimation, } from './engine.js';
|
|
3
5
|
import { getPreset } from './presets.js';
|
|
4
6
|
import { resolveHaptic } from './haptics.js';
|
|
5
|
-
import { isProperty } from './properties.js';
|
|
7
|
+
import { isProperty, precision } from './properties.js';
|
|
6
8
|
import { hasCurve, mergeTransitions, resolveTransition, springs, } from './transition.js';
|
|
7
9
|
/**
|
|
8
10
|
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
@@ -18,11 +20,82 @@ export function animate(target, animation, options) {
|
|
|
18
20
|
const { keyframes, base, overrides, stagger, relative, haptic } = prepare(animation, options);
|
|
19
21
|
const feedback = resolveHaptic(haptic);
|
|
20
22
|
if (!isList(target)) {
|
|
21
|
-
|
|
23
|
+
const view = toView(target);
|
|
24
|
+
for (const property of Object.keys(keyframes))
|
|
25
|
+
if (isColorProperty(property))
|
|
26
|
+
validateColorTarget(view, property);
|
|
27
|
+
return new ViewAnimation(view, plan(keyframes, base, overrides, 0, relative), feedback);
|
|
22
28
|
}
|
|
23
29
|
const views = target.map(toView);
|
|
30
|
+
for (const view of views)
|
|
31
|
+
for (const property of Object.keys(keyframes))
|
|
32
|
+
if (isColorProperty(property))
|
|
33
|
+
validateColorTarget(view, property);
|
|
24
34
|
return group(views.map((view, index) => new ViewAnimation(view, plan(keyframes, base, overrides, staggerDelay(stagger, index, views.length), relative), feedback)));
|
|
25
35
|
}
|
|
36
|
+
/** Starts at the current translation and slows down from a velocity in DIPs per second. */
|
|
37
|
+
export function decay(target, velocity, options = {}) {
|
|
38
|
+
const friction = options.friction ?? DEFAULT_FRICTION;
|
|
39
|
+
if (!Number.isFinite(friction) || friction <= 0 || friction >= 1) {
|
|
40
|
+
throw new RangeError('Decay friction must be between 0 and 1 exclusively.');
|
|
41
|
+
}
|
|
42
|
+
const stops = (values) => {
|
|
43
|
+
if (values === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
if (!Array.isArray(values) ||
|
|
46
|
+
values.length === 0 ||
|
|
47
|
+
![...values].every(Number.isFinite)) {
|
|
48
|
+
throw new RangeError('Decay snap needs a nonempty array of finite positions.');
|
|
49
|
+
}
|
|
50
|
+
return [...values];
|
|
51
|
+
};
|
|
52
|
+
const snap = options.snap;
|
|
53
|
+
if (snap !== undefined &&
|
|
54
|
+
!Array.isArray(snap) &&
|
|
55
|
+
(snap === null ||
|
|
56
|
+
typeof snap !== 'object' ||
|
|
57
|
+
Object.keys(snap).some((key) => key !== 'x' && key !== 'y'))) {
|
|
58
|
+
throw new TypeError('Decay snap must be an array or an object with x and y stops.');
|
|
59
|
+
}
|
|
60
|
+
const shared = Array.isArray(snap);
|
|
61
|
+
const perAxis = snap;
|
|
62
|
+
const snapped = shared ? stops(snap) : undefined;
|
|
63
|
+
const snapX = shared ? snapped : stops(perAxis?.x);
|
|
64
|
+
const snapY = shared ? snapped : stops(perAxis?.y);
|
|
65
|
+
const plans = Object.entries(velocity).flatMap(([property, value]) => {
|
|
66
|
+
if (property !== 'x' && property !== 'y') {
|
|
67
|
+
throw new Error(`Can't decay "${property}". Use x or y.`);
|
|
68
|
+
}
|
|
69
|
+
if (value === undefined)
|
|
70
|
+
return [];
|
|
71
|
+
if (!Number.isFinite(value)) {
|
|
72
|
+
throw new RangeError(`Invalid decay velocity for "${property}".`);
|
|
73
|
+
}
|
|
74
|
+
// Validate every axis before handing any plans to the engine.
|
|
75
|
+
solveDecay(0, value, friction, precision[property]);
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
property,
|
|
79
|
+
keyframes: [null, null],
|
|
80
|
+
transition: {
|
|
81
|
+
curve: {
|
|
82
|
+
type: 'decay',
|
|
83
|
+
friction,
|
|
84
|
+
velocity: value,
|
|
85
|
+
snap: property === 'x' ? snapX : snapY,
|
|
86
|
+
},
|
|
87
|
+
delay: 0,
|
|
88
|
+
repeat: 0,
|
|
89
|
+
reverse: false,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
});
|
|
94
|
+
const views = toViews(target);
|
|
95
|
+
if (plans.length === 0)
|
|
96
|
+
return group([]);
|
|
97
|
+
return group(views.map((view) => new ViewAnimation(view, plans)));
|
|
98
|
+
}
|
|
26
99
|
/** Stops all or selected properties at their current values. `scale` stops both axes. */
|
|
27
100
|
export function stop(target, properties) {
|
|
28
101
|
const expanded = properties?.flatMap((property) => property === 'scale' ? ['scaleX', 'scaleY'] : [property]);
|
|
@@ -124,7 +197,10 @@ export function startingValues(animation, options) {
|
|
|
124
197
|
const { keyframes, relative } = prepare(animation, options);
|
|
125
198
|
if (!keyframes)
|
|
126
199
|
throw new Error(`Unknown preset "${animation}".`);
|
|
127
|
-
return new Map(expand(keyframes).map(([property, [first]]) => [
|
|
200
|
+
return new Map(expand(keyframes).map(([property, [first]]) => [
|
|
201
|
+
property,
|
|
202
|
+
relative && !isColorProperty(property) ? null : first,
|
|
203
|
+
]));
|
|
128
204
|
}
|
|
129
205
|
function expand(keyframes) {
|
|
130
206
|
const expanded = [];
|
|
@@ -143,6 +219,16 @@ function expand(keyframes) {
|
|
|
143
219
|
return expanded;
|
|
144
220
|
}
|
|
145
221
|
function toKeyframes(property, value) {
|
|
222
|
+
if (isColorProperty(property)) {
|
|
223
|
+
const frames = Array.isArray(value) ? [...value] : [null, value];
|
|
224
|
+
if (!frames.length)
|
|
225
|
+
throw new TypeError(`Empty color keyframes for "${property}".`);
|
|
226
|
+
if (frames.length === 1)
|
|
227
|
+
frames.unshift(null);
|
|
228
|
+
return frames.map((frame) => (frame === null ? null : parseColor(frame)));
|
|
229
|
+
}
|
|
230
|
+
if (typeof value !== 'number' && !Array.isArray(value))
|
|
231
|
+
throw new TypeError(`Invalid numeric keyframes for "${property}".`);
|
|
146
232
|
const frames = typeof value === 'number' ? [null, value] : [...value];
|
|
147
233
|
if (frames.length === 1)
|
|
148
234
|
frames.unshift(null);
|
package/dist/animate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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KAAK,GAAG,MAAM,CAAC,CAAA;AACxC,CAAC;AAED,SAAS,MAAM,CAAC,IAAgB;IAC9B,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAA;IAC7D,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
package/dist/color.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Color, type View } from '@nativescript/core';
|
|
2
|
+
export type ColorProperty = 'backgroundColor' | 'borderColor' | 'color';
|
|
3
|
+
export type ColorValue = string | Color;
|
|
4
|
+
export type ColorKeyframes = ColorValue | readonly (ColorValue | null)[];
|
|
5
|
+
export declare const isColorProperty: (property: string) => property is ColorProperty;
|
|
6
|
+
export declare function parseColor(value: unknown): number;
|
|
7
|
+
export declare function readColor(view: View, property: ColorProperty): number;
|
|
8
|
+
export declare function validateColorTarget(view: View, property: ColorProperty): void;
|
|
9
|
+
/** Premultiplied OKLab interpolation, clipped to the sRGB output gamut. */
|
|
10
|
+
export declare function colorMixer(from: number, to: number): (progress: number) => number;
|
|
11
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,EAA0B,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAErF,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,aAAa,GAAG,OAAO,CAAA;AACvE,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,CAAA;AACvC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAA;AACxE,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,QAAQ,IAAI,aACuB,CAAA;AAEtF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKjD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,CAOrE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,QAwBtE;AAsBD,2EAA2E;AAC3E,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CA6BjF"}
|
package/dist/color.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Button, Color, Label, TextBase, isIOS } from '@nativescript/core';
|
|
2
|
+
export const isColorProperty = (property) => property === 'backgroundColor' || property === 'borderColor' || property === 'color';
|
|
3
|
+
export function parseColor(value) {
|
|
4
|
+
if (value instanceof Color)
|
|
5
|
+
return value.argb >>> 0;
|
|
6
|
+
if (typeof value !== 'string' || !Color.isValid(value))
|
|
7
|
+
throw new TypeError(`Invalid animation color: ${String(value)}.`);
|
|
8
|
+
return new Color(value).argb >>> 0;
|
|
9
|
+
}
|
|
10
|
+
export function readColor(view, property) {
|
|
11
|
+
const value = property === 'borderColor' ? view.borderTopColor : view[property];
|
|
12
|
+
return value instanceof Color
|
|
13
|
+
? value.argb >>> 0
|
|
14
|
+
: property === 'backgroundColor'
|
|
15
|
+
? 0
|
|
16
|
+
: 0xff000000;
|
|
17
|
+
}
|
|
18
|
+
export function validateColorTarget(view, property) {
|
|
19
|
+
if (property === 'color' &&
|
|
20
|
+
!(isIOS ? view instanceof Label || view instanceof Button : view instanceof TextBase))
|
|
21
|
+
throw new TypeError('Text color animation requires a Label or Button on iOS, or a TextBase on Android.');
|
|
22
|
+
if (property === 'borderColor') {
|
|
23
|
+
const colors = [
|
|
24
|
+
view.borderTopColor,
|
|
25
|
+
view.borderRightColor,
|
|
26
|
+
view.borderBottomColor,
|
|
27
|
+
view.borderLeftColor,
|
|
28
|
+
];
|
|
29
|
+
if (colors.some((color) => (color?.argb ?? 0xff000000) !== (colors[0]?.argb ?? 0xff000000)))
|
|
30
|
+
throw new TypeError('borderColor animation requires the same starting color on every edge.');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const clamp = (value) => Math.max(0, Math.min(1, value));
|
|
34
|
+
const linear = (channel) => channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
35
|
+
const encoded = (channel) => channel <= 0.0031308 ? 12.92 * channel : 1.055 * channel ** (1 / 2.4) - 0.055;
|
|
36
|
+
function lab(value) {
|
|
37
|
+
const r = linear(((value >>> 16) & 255) / 255);
|
|
38
|
+
const g = linear(((value >>> 8) & 255) / 255);
|
|
39
|
+
const b = linear((value & 255) / 255);
|
|
40
|
+
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
41
|
+
const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
|
|
42
|
+
const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
|
|
43
|
+
return [
|
|
44
|
+
0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s,
|
|
45
|
+
1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s,
|
|
46
|
+
0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s,
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
/** Premultiplied OKLab interpolation, clipped to the sRGB output gamut. */
|
|
50
|
+
export function colorMixer(from, to) {
|
|
51
|
+
const a = lab(from), b = lab(to);
|
|
52
|
+
const alphaA = (from >>> 24) / 255, alphaB = (to >>> 24) / 255;
|
|
53
|
+
return (progress) => {
|
|
54
|
+
const p = clamp(progress);
|
|
55
|
+
if (p === 0)
|
|
56
|
+
return from;
|
|
57
|
+
if (p === 1)
|
|
58
|
+
return to;
|
|
59
|
+
const alpha = alphaA + (alphaB - alphaA) * p;
|
|
60
|
+
if (alpha <= 0)
|
|
61
|
+
return 0;
|
|
62
|
+
const channel = (i) => (a[i] * alphaA * (1 - p) + b[i] * alphaB * p) / alpha;
|
|
63
|
+
const L = channel(0), A = channel(1), B = channel(2);
|
|
64
|
+
const l = (L + 0.3963377774 * A + 0.2158037573 * B) ** 3;
|
|
65
|
+
const m = (L - 0.1055613458 * A - 0.0638541728 * B) ** 3;
|
|
66
|
+
const s = (L - 0.0894841775 * A - 1.291485548 * B) ** 3;
|
|
67
|
+
const r = Math.round(clamp(encoded(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s)) * 255);
|
|
68
|
+
const g = Math.round(clamp(encoded(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s)) * 255);
|
|
69
|
+
const blue = Math.round(clamp(encoded(-0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s)) * 255);
|
|
70
|
+
return ((Math.round(alpha * 255) << 24) | (r << 16) | (g << 8) | blue) >>> 0;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","sourceRoot":"","sources":["../src/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;AAKrF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAgB,EAA6B,EAAE,CAC7E,QAAQ,KAAK,iBAAiB,IAAI,QAAQ,KAAK,aAAa,IAAI,QAAQ,KAAK,OAAO,CAAA;AAEtF,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,KAAK,YAAY,KAAK;QAAE,OAAO,KAAK,CAAC,IAAI,KAAK,CAAC,CAAA;IACnD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpD,MAAM,IAAI,SAAS,CAAC,4BAA4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
+
velocity(time: number): number;
|
|
6
|
+
}
|
|
7
|
+
/** Velocity retains this fraction every millisecond, independently of the display's refresh rate. */
|
|
8
|
+
export declare const DEFAULT_FRICTION = 0.998;
|
|
9
|
+
/** Exponential motion, with velocity in units per second and time in milliseconds. */
|
|
10
|
+
export declare function solveDecay(from: number, velocity: number, friction: number, precision: number): DecayMotion;
|
|
11
|
+
//# sourceMappingURL=decay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decay.d.ts","sourceRoot":"","sources":["../src/decay.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAC/B;AAED,qGAAqG;AACrG,eAAO,MAAM,gBAAgB,QAAQ,CAAA;AAErC,sFAAsF;AACtF,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,WAAW,CA4Bb"}
|
package/dist/decay.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Velocity retains this fraction every millisecond, independently of the display's refresh rate. */
|
|
2
|
+
export const DEFAULT_FRICTION = 0.998;
|
|
3
|
+
/** Exponential motion, with velocity in units per second and time in milliseconds. */
|
|
4
|
+
export function solveDecay(from, velocity, friction, precision) {
|
|
5
|
+
const rate = -Math.log(friction);
|
|
6
|
+
const distance = velocity / (1000 * rate);
|
|
7
|
+
const to = from + distance;
|
|
8
|
+
// Stop only when both the remaining distance and speed are imperceptible.
|
|
9
|
+
const duration = velocity === 0
|
|
10
|
+
? 0
|
|
11
|
+
: Math.ceil(Math.max(0, Math.log(Math.abs(distance) / precision) / rate, Math.log(Math.abs(velocity) / (precision * 10)) / rate));
|
|
12
|
+
if (!Number.isFinite(to) || !Number.isFinite(duration) || duration > 2_147_483_647) {
|
|
13
|
+
throw new RangeError('Decay velocity and friction produce an unplayable motion.');
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
duration,
|
|
17
|
+
to,
|
|
18
|
+
position: (time) => time >= duration ? to : from - distance * Math.expm1(-rate * Math.max(0, time)),
|
|
19
|
+
velocity: (time) => time >= duration ? 0 : velocity * Math.exp(-rate * Math.max(0, time)),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=decay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decay.js","sourceRoot":"","sources":["../src/decay.ts"],"names":[],"mappings":"AAOA,qGAAqG;AACrG,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAErC,sFAAsF;AACtF,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,QAAgB,EAChB,QAAgB,EAChB,SAAiB;IAEjB,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAChC,MAAM,QAAQ,GAAG,QAAQ,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;IACzC,MAAM,EAAE,GAAG,IAAI,GAAG,QAAQ,CAAA;IAC1B,0EAA0E;IAC1E,MAAM,QAAQ,GACZ,QAAQ,KAAK,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,IAAI,CACP,IAAI,CAAC,GAAG,CACN,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,GAAG,IAAI,EAC/C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CACvD,CACF,CAAA;IAEP,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,aAAa,EAAE,CAAC;QACnF,MAAM,IAAI,UAAU,CAAC,2DAA2D,CAAC,CAAA;IACnF,CAAC;IAED,OAAO;QACL,QAAQ;QACR,EAAE;QACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CACjB,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACjF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CACjB,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACxE,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type View } from '@nativescript/core';
|
|
2
|
+
import { type ColorProperty } from '../color.js';
|
|
3
|
+
import type { Track } from '../track.js';
|
|
4
|
+
interface NativeTarget {
|
|
5
|
+
getColor(): number;
|
|
6
|
+
setColor(value: number): void;
|
|
7
|
+
isSupported(): boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ColorHandle {
|
|
10
|
+
cancel(): void;
|
|
11
|
+
elapsed(): number;
|
|
12
|
+
target: NativeTarget;
|
|
13
|
+
}
|
|
14
|
+
export declare function presentedAndroidColor(view: View, property: ColorProperty): number;
|
|
15
|
+
export declare function playAndroidColor(view: View, track: Track, onEnd: (finished?: boolean) => void): ColorHandle;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=android-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"android-color.d.ts","sourceRoot":"","sources":["../../src/driver/android-color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAa,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,UAAU,YAAY;IACpB,QAAQ,IAAI,MAAM,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,WAAW,IAAI,OAAO,CAAA;CACvB;AACD,UAAU,WAAW;IACnB,MAAM,IAAI,IAAI,CAAA;IACd,OAAO,IAAI,MAAM,CAAA;IACjB,MAAM,EAAE,YAAY,CAAA;CACrB;AAGD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,GAAG,MAAM,CAMjF;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,GAClC,WAAW,CA2Ib"}
|