@rafaelaugusto/jolt 0.1.0-beta.1 → 0.1.0-beta.3
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 +115 -8
- package/dist/animate.d.ts +3 -1
- package/dist/animate.d.ts.map +1 -1
- package/dist/animate.js +83 -6
- package/dist/animate.js.map +1 -1
- 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.d.ts +1 -1
- package/dist/driver/android.d.ts.map +1 -1
- package/dist/driver/android.js +95 -5
- package/dist/driver/android.js.map +1 -1
- package/dist/driver/index.d.ts +3 -1
- package/dist/driver/index.d.ts.map +1 -1
- package/dist/driver/index.js.map +1 -1
- package/dist/driver/ios.d.ts.map +1 -1
- package/dist/driver/ios.js +7 -0
- package/dist/driver/ios.js.map +1 -1
- package/dist/engine.d.ts +6 -3
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +21 -5
- package/dist/engine.js.map +1 -1
- package/dist/haptics.d.ts +18 -0
- package/dist/haptics.d.ts.map +1 -0
- package/dist/haptics.js +96 -0
- package/dist/haptics.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- 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/particles.d.ts +39 -0
- package/dist/particles.d.ts.map +1 -0
- package/dist/particles.js +264 -0
- package/dist/particles.js.map +1 -0
- package/dist/properties.d.ts +1 -1
- package/dist/properties.d.ts.map +1 -1
- package/dist/properties.js +1 -1
- 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/shimmer.d.ts +12 -0
- package/dist/shimmer.d.ts.map +1 -0
- package/dist/shimmer.js +160 -0
- package/dist/shimmer.js.map +1 -0
- package/dist/symbol-effect.d.ts +23 -0
- package/dist/symbol-effect.d.ts.map +1 -0
- package/dist/symbol-effect.js +186 -0
- package/dist/symbol-effect.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 +264 -0
- package/dist/text.js.map +1 -0
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +25 -3
- 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.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/animate.ts +96 -4
- package/src/decay.ts +45 -0
- package/src/driver/android.ts +112 -6
- package/src/driver/index.ts +3 -1
- package/src/driver/ios.ts +11 -0
- package/src/engine.ts +22 -6
- package/src/haptics.ts +125 -0
- package/src/index.ts +18 -1
- package/src/loader.ts +201 -0
- package/src/particles.ts +323 -0
- package/src/properties.ts +1 -1
- package/src/reveal.ts +374 -0
- package/src/shimmer.ts +179 -0
- package/src/symbol-effect.ts +225 -0
- package/src/text-layout.ts +216 -0
- package/src/text.ts +296 -0
- package/src/track.ts +42 -3
- package/src/transition.ts +6 -0
- package/src/types.ts +16 -0
package/README.md
CHANGED
|
@@ -35,10 +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
|
+
- [Decay](#decay) from a release velocity, with optional snap points.
|
|
38
39
|
- [Keyframes and tweens](#tweens) with an easing per segment and exact keyframe times.
|
|
39
40
|
- [Stagger](#several-views) across several views, from the first, the last or the center.
|
|
40
41
|
- [Sequences](#sequences) that start each step once the previous one looks done.
|
|
41
42
|
- [Press effects](#press) that follow the finger and let go when a scroll takes over.
|
|
43
|
+
- [Text entrances](#text) by letter or word on iOS, preserving the Label’s layout and accessibility.
|
|
44
|
+
- [SF Symbol effects](#sf-symbols) and animated icon replacement on iOS 17+.
|
|
45
|
+
- [Shimmer](#shimmer) for loading placeholders on iOS.
|
|
46
|
+
- [Loaders](#loaders) with dots, bars and ring styles on iOS.
|
|
47
|
+
- [Circular reveal](#circular-reveal) to show or hide content from a point on iOS.
|
|
48
|
+
- [Haptics](#haptics) at arrival or at marked points in an animation on iOS.
|
|
49
|
+
- [Particles and confetti](#particles-and-confetti) on iOS.
|
|
42
50
|
- [Interruptions](#interrupting-and-stopping) that pick up the value and velocity on screen, with no jump.
|
|
43
51
|
- [Native playback](#how-it-works): Core Animation on iOS, `ObjectAnimator` on Android, nothing in JavaScript while it plays.
|
|
44
52
|
|
|
@@ -50,6 +58,8 @@ npm install @rafaelaugusto/jolt@next
|
|
|
50
58
|
|
|
51
59
|
It's in beta for now, 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.
|
|
52
60
|
|
|
61
|
+
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.
|
|
62
|
+
|
|
53
63
|
## Animating
|
|
54
64
|
|
|
55
65
|
`animate(target, keyframes, transition?)` takes a view and where to take it:
|
|
@@ -67,6 +77,8 @@ animate(card, { opacity: 0.5, y: -20 })
|
|
|
67
77
|
| `rotate` | degrees |
|
|
68
78
|
| `rotateX`, `rotateY` | degrees, with perspective |
|
|
69
79
|
|
|
80
|
+
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.
|
|
81
|
+
|
|
70
82
|
A single value animates from wherever the view is. An array is a list of keyframes, and `null` stands for the current value:
|
|
71
83
|
|
|
72
84
|
```ts
|
|
@@ -157,6 +169,19 @@ animate(
|
|
|
157
169
|
|
|
158
170
|
`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.
|
|
159
171
|
|
|
172
|
+
## Decay
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { decay } from '@rafaelaugusto/jolt'
|
|
176
|
+
|
|
177
|
+
decay(card, { x: 600 }) // DIPs per second
|
|
178
|
+
decay(card, { x: 600 }, { friction: 0.998, snap: [0, 320] })
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
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.
|
|
182
|
+
|
|
183
|
+
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).
|
|
184
|
+
|
|
160
185
|
## Presets
|
|
161
186
|
|
|
162
187
|
```ts
|
|
@@ -241,6 +266,84 @@ press(tile, { scale: 0.9, rotate: -4 }, 'bouncy')
|
|
|
241
266
|
|
|
242
267
|
Animates to the given values while a finger is down, and back to where the view was once it lifts, or once the touch is cancelled by a scroll taking over. Views with `isEnabled` set to `false` don't react. It returns a function that removes the effect.
|
|
243
268
|
|
|
269
|
+
## SF Symbols
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
import { symbolEffect } from '@rafaelaugusto/jolt'
|
|
273
|
+
|
|
274
|
+
symbolEffect(bell, 'bounce')
|
|
275
|
+
symbolEffect(favorite, { replace: 'sys://heart.fill' })
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Takes a NativeScript `Image` with a `sys://` source, or a ref holding one. Supports `bounce`, `pulse`, `scale` and `variableColor`, with native playback, completion and cancellation. Replacement keeps the Image's source in sync. Scale holds until stopped; bounce, pulse and variable color can repeat with `{ repeat: true }`.
|
|
279
|
+
|
|
280
|
+
Effects require iOS 17+. Earlier iOS versions and Reduce Motion skip decorative effects and replace icons immediately. Android calls resolve with `false` without changing the image. See [SF Symbol effects](https://jolt.rafaelaugusto.dev/guide/symbol-effects) for options and lifecycle behavior.
|
|
281
|
+
|
|
282
|
+
## Shimmer
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import { shimmer } from '@rafaelaugusto/jolt'
|
|
286
|
+
|
|
287
|
+
const stopShimmer = shimmer(placeholder, { duration: 1500 })
|
|
288
|
+
stopShimmer() // when the content is ready
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
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).
|
|
292
|
+
|
|
293
|
+
## Loaders
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
import { loader } from '@rafaelaugusto/jolt'
|
|
297
|
+
|
|
298
|
+
const stopLoading = loader(slot, { style: 'dots', color: '#71717a', size: 48 })
|
|
299
|
+
stopLoading() // when the content is ready
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
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).
|
|
303
|
+
|
|
304
|
+
## Circular reveal
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
import { reveal, conceal } from '@rafaelaugusto/jolt'
|
|
308
|
+
|
|
309
|
+
await reveal(details, { from: { x: 40, y: 40 }, duration: 500 })
|
|
310
|
+
await conceal(details, { to: { x: 40, y: 40 } })
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
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.
|
|
314
|
+
|
|
315
|
+
## Text
|
|
316
|
+
|
|
317
|
+
```ts
|
|
318
|
+
import { animateText } from '@rafaelaugusto/jolt'
|
|
319
|
+
|
|
320
|
+
await animateText(title)
|
|
321
|
+
await animateText(title, { by: 'word', stagger: 100 })
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
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.
|
|
325
|
+
|
|
326
|
+
## Haptics
|
|
327
|
+
|
|
328
|
+
```ts
|
|
329
|
+
animate(card, { y: 0 }, { type: 'spring', haptic: 'light' })
|
|
330
|
+
animate(button, 'bounce', { haptic: { style: 'light', times: [0.6, 1] } })
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
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 only for now. See the [haptics guide](https://jolt.rafaelaugusto.dev/guide/haptics) for timing and device behavior.
|
|
334
|
+
|
|
335
|
+
## Particles and confetti
|
|
336
|
+
|
|
337
|
+
```ts
|
|
338
|
+
import { confetti, particles } from '@rafaelaugusto/jolt'
|
|
339
|
+
|
|
340
|
+
confetti(button, { count: 80, colors: ['#facc15', '#ef4444', '#3b82f6'] })
|
|
341
|
+
const stopSnow = particles(scene, { source: 'top', angle: 90, velocity: 45 })
|
|
342
|
+
stopSnow() // remove the emitter and its particles
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Confetti bursts into the target's window and cleans itself up. `particles()` adds an emitter to the view for snow, sparks, bubbles or other effects. Both use Core Animation without JavaScript per frame, respect Reduce Motion and stop on unload. iOS only for now. See the [particles guide](https://jolt.rafaelaugusto.dev/guide/particles).
|
|
346
|
+
|
|
244
347
|
## Interrupting and stopping
|
|
245
348
|
|
|
246
349
|
Starting an animation on a property that's already animating takes it over: the new one starts from the value on screen, with the same velocity, so a card can change its mind halfway without a jump. Other properties of the previous animation keep going.
|
|
@@ -261,7 +364,7 @@ If part of an animation is stopped, its `finished` promise resolves with `false`
|
|
|
261
364
|
|
|
262
365
|
## How it works
|
|
263
366
|
|
|
264
|
-
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 aren't sampled at all.
|
|
367
|
+
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 segments aren't sampled at all. Very long free decays cap sampling at 6,001 keyframes.
|
|
265
368
|
|
|
266
369
|
The samples go to the platform in one go:
|
|
267
370
|
|
|
@@ -270,25 +373,27 @@ The samples go to the platform in one go:
|
|
|
270
373
|
|
|
271
374
|
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.
|
|
272
375
|
|
|
273
|
-
|
|
376
|
+
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.
|
|
377
|
+
|
|
378
|
+
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.
|
|
274
379
|
|
|
275
380
|
## Not there yet
|
|
276
381
|
|
|
277
|
-
-
|
|
278
|
-
-
|
|
382
|
+
- `animate()` covers transforms and opacity. Colors ([#12](https://github.com/rafaelaugustos/jolt/issues/12)), borders 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.
|
|
383
|
+
- Gesture tracking and drag constraints are next ([#23](https://github.com/rafaelaugustos/jolt/issues/23)); `decay()` supplies the motion after release.
|
|
279
384
|
- No layout or shared element transitions ([#21](https://github.com/rafaelaugustos/jolt/issues/21), [#24](https://github.com/rafaelaugustos/jolt/issues/24)).
|
|
280
385
|
|
|
281
386
|
## API
|
|
282
387
|
|
|
283
|
-
**Animating**: `animate(target, keyframes | preset, transition?)`, `stop(target, properties?)`, `sequence(steps)`, `press(target, pressed?, transition?)`.
|
|
388
|
+
**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?)`, `loader(target, options?)`, `reveal(target, options?)`, `conceal(target, options?)`, `confetti(target, options?)`, `particles(target, options?)`.
|
|
284
389
|
|
|
285
|
-
**Animations**
|
|
390
|
+
**Animations** from `animate()`, `decay()`, `sequence()`, `symbolEffect()`, `reveal()` and `conceal()`: `await`, `finished`, `stop()`. `press()`, `shimmer()`, `loader()`, `confetti()` and `particles()` return cleanup functions.
|
|
286
391
|
|
|
287
392
|
**Helpers**: `definePreset`, `presets`, `springs`, `cubicBezier`, plus the types (`Keyframes`, `Transition`, `Spring`, `Tween`, `Preset`, `Presets`, `PresetName`, `SpringName`, `Easing`, `Animation`, `Target`...).
|
|
288
393
|
|
|
289
394
|
## Demo
|
|
290
395
|
|
|
291
|
-
[`demo/`](./demo) is a NativeScript-Vue app with every preset, the three springs on a ball you can interrupt, stagger, press effects, loops and a sequence on launch.
|
|
396
|
+
[`demo/`](./demo) is a NativeScript-Vue app with every preset, the three springs on a ball you can interrupt, decay and snapping, stagger, press effects, SF Symbols, shimmer, loaders, circular reveals, haptics and particles on iOS, loops and a sequence on launch.
|
|
292
397
|
|
|
293
398
|
With the [NativeScript CLI](https://docs.nativescript.org/setup/) installed:
|
|
294
399
|
|
|
@@ -311,6 +416,8 @@ npm run build
|
|
|
311
416
|
|
|
312
417
|
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.
|
|
313
418
|
|
|
419
|
+
For on-device measurements, see the [iOS animation startup benchmark](./benchmarks/README.md).
|
|
420
|
+
|
|
314
421
|
### Releasing
|
|
315
422
|
|
|
316
423
|
1. Bump `version` in `package.json` (`npm version <version> --no-git-tag-version`) and move the changes under it in `CHANGELOG.md`.
|
|
@@ -321,4 +428,4 @@ Publishing authenticates with the `NPM_TOKEN` secret, or with [trusted publishin
|
|
|
321
428
|
|
|
322
429
|
## License
|
|
323
430
|
|
|
324
|
-
[MIT](./LICENSE)
|
|
431
|
+
[MIT](./LICENSE). Maintained by Rafael Augusto and [Cortex Labs](https://getcortexlabs.com/).
|
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;AAEzC,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,CAgCX;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,gCAOtC"}
|
package/dist/animate.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { View } from '@nativescript/core';
|
|
2
|
+
import { DEFAULT_FRICTION, solveDecay } from './decay.js';
|
|
2
3
|
import { arrivalOf, setArrival, stopView, ViewAnimation, } from './engine.js';
|
|
3
4
|
import { getPreset } from './presets.js';
|
|
4
|
-
import {
|
|
5
|
+
import { resolveHaptic } from './haptics.js';
|
|
6
|
+
import { isProperty, precision } from './properties.js';
|
|
5
7
|
import { hasCurve, mergeTransitions, resolveTransition, springs, } from './transition.js';
|
|
6
8
|
/**
|
|
7
9
|
* Animates one view, or several. Takes keyframes or the name of a preset,
|
|
@@ -14,12 +16,76 @@ import { hasCurve, mergeTransitions, resolveTransition, springs, } from './trans
|
|
|
14
16
|
* ```
|
|
15
17
|
*/
|
|
16
18
|
export function animate(target, animation, options) {
|
|
17
|
-
const { keyframes, base, overrides, stagger, relative } = prepare(animation, options);
|
|
19
|
+
const { keyframes, base, overrides, stagger, relative, haptic } = prepare(animation, options);
|
|
20
|
+
const feedback = resolveHaptic(haptic);
|
|
18
21
|
if (!isList(target)) {
|
|
19
|
-
return new ViewAnimation(toView(target), plan(keyframes, base, overrides, 0, relative));
|
|
22
|
+
return new ViewAnimation(toView(target), plan(keyframes, base, overrides, 0, relative), feedback);
|
|
20
23
|
}
|
|
21
24
|
const views = target.map(toView);
|
|
22
|
-
return group(views.map((view, index) => new ViewAnimation(view, plan(keyframes, base, overrides, staggerDelay(stagger, index, views.length), relative))));
|
|
25
|
+
return group(views.map((view, index) => new ViewAnimation(view, plan(keyframes, base, overrides, staggerDelay(stagger, index, views.length), relative), feedback)));
|
|
26
|
+
}
|
|
27
|
+
/** Starts at the current translation and slows down from a velocity in DIPs per second. */
|
|
28
|
+
export function decay(target, velocity, options = {}) {
|
|
29
|
+
const friction = options.friction ?? DEFAULT_FRICTION;
|
|
30
|
+
if (!Number.isFinite(friction) || friction <= 0 || friction >= 1) {
|
|
31
|
+
throw new RangeError('Decay friction must be between 0 and 1 exclusively.');
|
|
32
|
+
}
|
|
33
|
+
const stops = (values) => {
|
|
34
|
+
if (values === undefined)
|
|
35
|
+
return undefined;
|
|
36
|
+
if (!Array.isArray(values) ||
|
|
37
|
+
values.length === 0 ||
|
|
38
|
+
![...values].every(Number.isFinite)) {
|
|
39
|
+
throw new RangeError('Decay snap needs a nonempty array of finite positions.');
|
|
40
|
+
}
|
|
41
|
+
return [...values];
|
|
42
|
+
};
|
|
43
|
+
const snap = options.snap;
|
|
44
|
+
if (snap !== undefined &&
|
|
45
|
+
!Array.isArray(snap) &&
|
|
46
|
+
(snap === null ||
|
|
47
|
+
typeof snap !== 'object' ||
|
|
48
|
+
Object.keys(snap).some((key) => key !== 'x' && key !== 'y'))) {
|
|
49
|
+
throw new TypeError('Decay snap must be an array or an object with x and y stops.');
|
|
50
|
+
}
|
|
51
|
+
const shared = Array.isArray(snap);
|
|
52
|
+
const perAxis = snap;
|
|
53
|
+
const snapped = shared ? stops(snap) : undefined;
|
|
54
|
+
const snapX = shared ? snapped : stops(perAxis?.x);
|
|
55
|
+
const snapY = shared ? snapped : stops(perAxis?.y);
|
|
56
|
+
const plans = Object.entries(velocity).flatMap(([property, value]) => {
|
|
57
|
+
if (property !== 'x' && property !== 'y') {
|
|
58
|
+
throw new Error(`Can't decay "${property}". Use x or y.`);
|
|
59
|
+
}
|
|
60
|
+
if (value === undefined)
|
|
61
|
+
return [];
|
|
62
|
+
if (!Number.isFinite(value)) {
|
|
63
|
+
throw new RangeError(`Invalid decay velocity for "${property}".`);
|
|
64
|
+
}
|
|
65
|
+
// Validate every axis before handing any plans to the engine.
|
|
66
|
+
solveDecay(0, value, friction, precision[property]);
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
property,
|
|
70
|
+
keyframes: [null, null],
|
|
71
|
+
transition: {
|
|
72
|
+
curve: {
|
|
73
|
+
type: 'decay',
|
|
74
|
+
friction,
|
|
75
|
+
velocity: value,
|
|
76
|
+
snap: property === 'x' ? snapX : snapY,
|
|
77
|
+
},
|
|
78
|
+
delay: 0,
|
|
79
|
+
repeat: 0,
|
|
80
|
+
reverse: false,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
});
|
|
85
|
+
const views = toViews(target);
|
|
86
|
+
if (plans.length === 0)
|
|
87
|
+
return group([]);
|
|
88
|
+
return group(views.map((view) => new ViewAnimation(view, plans)));
|
|
23
89
|
}
|
|
24
90
|
/** Stops all or selected properties at their current values. `scale` stops both axes. */
|
|
25
91
|
export function stop(target, properties) {
|
|
@@ -67,22 +133,31 @@ function prepare(animation, options) {
|
|
|
67
133
|
: { ...own.overrides, ...user.overrides },
|
|
68
134
|
stagger: user.stagger ?? own.stagger,
|
|
69
135
|
relative: user.relative ?? own.relative,
|
|
136
|
+
haptic: user.haptic ?? own.haptic,
|
|
70
137
|
};
|
|
71
138
|
}
|
|
72
139
|
function normalize(options) {
|
|
73
140
|
if (options === undefined)
|
|
74
|
-
return {
|
|
141
|
+
return {
|
|
142
|
+
base: {},
|
|
143
|
+
overrides: {},
|
|
144
|
+
stagger: undefined,
|
|
145
|
+
relative: undefined,
|
|
146
|
+
haptic: undefined,
|
|
147
|
+
};
|
|
75
148
|
if (typeof options === 'string')
|
|
76
149
|
return {
|
|
77
150
|
base: spring(options),
|
|
78
151
|
overrides: {},
|
|
79
152
|
stagger: undefined,
|
|
80
153
|
relative: undefined,
|
|
154
|
+
haptic: undefined,
|
|
81
155
|
};
|
|
82
156
|
const base = {};
|
|
83
157
|
const overrides = {};
|
|
84
158
|
let stagger;
|
|
85
159
|
let relative;
|
|
160
|
+
let haptic;
|
|
86
161
|
for (const [key, value] of Object.entries(options)) {
|
|
87
162
|
if (value === undefined)
|
|
88
163
|
continue;
|
|
@@ -90,13 +165,15 @@ function normalize(options) {
|
|
|
90
165
|
stagger = value;
|
|
91
166
|
else if (key === 'relative')
|
|
92
167
|
relative = value;
|
|
168
|
+
else if (key === 'haptic')
|
|
169
|
+
haptic = value;
|
|
93
170
|
else if (key === 'scale' || isProperty(key)) {
|
|
94
171
|
overrides[key] = typeof value === 'string' ? spring(value) : value;
|
|
95
172
|
}
|
|
96
173
|
else
|
|
97
174
|
base[key] = value;
|
|
98
175
|
}
|
|
99
|
-
return { base, overrides, stagger, relative };
|
|
176
|
+
return { base, overrides, stagger, relative, haptic };
|
|
100
177
|
}
|
|
101
178
|
function plan(keyframes, base, overrides, offset, relative = false) {
|
|
102
179
|
return expand(keyframes).map(([property, frames]) => {
|
package/dist/animate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animate.js","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,aAAa,GAGd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,UAAU,EAAiB,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"animate.js","sourceRoot":"","sources":["../src/animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,aAAa,GAGd,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,SAAS,EAAmB,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,aAAa,EAAe,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAiB,MAAM,iBAAiB,CAAA;AACtE,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,iBAAiB,EACjB,OAAO,GAGR,MAAM,iBAAiB,CAAA;AAmBxB;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CACrB,MAAkC,EAClC,SAAiC,EACjC,OAAqC;IAErC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CACvE,SAAS,EACT,OAAO,CACR,CAAA;IACD,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,CAAA;IAEtC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;QACpB,OAAO,IAAI,aAAa,CACtB,MAAM,CAAC,MAAM,CAAC,EACd,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,QAA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AAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;IAC3D,MAAM,MAAM,GACV,IAAI,KAAK,OAAO;QACd,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,KAAK,MAAM;YACf,CAAC,CAAC,KAAK,GAAG,CAAC;YACX,CAAC,CAAC,IAAI,KAAK,QAAQ;gBACjB,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;gBACjB,CAAC,CAAC,IAAI,CAAA;IACd,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,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/decay.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface DecayMotion {
|
|
2
|
+
duration: number;
|
|
3
|
+
to: number;
|
|
4
|
+
position(time: number): number;
|
|
5
|
+
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":[],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,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"}
|
package/dist/driver/android.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/driver/android.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"android.d.ts","sourceRoot":"","sources":["../../src/driver/android.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AA4DxC,wBAAgB,mBAAmB,IAAI,MAAM,CAgJ5C"}
|
package/dist/driver/android.js
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
import { Utils } from '@nativescript/core';
|
|
2
|
-
|
|
2
|
+
/** Own only layers we create; keep app-configured hardware/software layers and paints intact. */
|
|
3
|
+
function fadeLayer(view, nativeView) {
|
|
4
|
+
const { View, ViewGroup } = android.view;
|
|
5
|
+
if (!view.isLoaded ||
|
|
6
|
+
view.nativeViewProtected !== nativeView ||
|
|
7
|
+
!(nativeView instanceof ViewGroup) ||
|
|
8
|
+
nativeView.getChildCount() === 0 ||
|
|
9
|
+
!nativeView.isHardwareAccelerated() ||
|
|
10
|
+
nativeView.getLayerType() !== View.LAYER_TYPE_NONE)
|
|
11
|
+
return undefined;
|
|
12
|
+
// Do not cache an entire oversized scrolling/content tree into a GPU texture.
|
|
13
|
+
const { widthPixels, heightPixels } = nativeView.getResources().getDisplayMetrics();
|
|
14
|
+
const width = nativeView.getWidth();
|
|
15
|
+
const height = nativeView.getHeight();
|
|
16
|
+
if (width <= 0 || height <= 0 || width > widthPixels || height > heightPixels)
|
|
17
|
+
return undefined;
|
|
18
|
+
nativeView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
19
|
+
let active = true;
|
|
20
|
+
const restore = () => {
|
|
21
|
+
if (!active)
|
|
22
|
+
return;
|
|
23
|
+
active = false;
|
|
24
|
+
view.off('unloaded', restore);
|
|
25
|
+
if (nativeView.getLayerType() === View.LAYER_TYPE_HARDWARE) {
|
|
26
|
+
nativeView.setLayerType(View.LAYER_TYPE_NONE, null);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
view.on('unloaded', restore);
|
|
30
|
+
return restore;
|
|
31
|
+
}
|
|
3
32
|
const accessors = {
|
|
4
33
|
opacity: { get: (v) => v.getAlpha(), set: (v, value) => v.setAlpha(value) },
|
|
5
34
|
x: { get: (v) => v.getTranslationX(), set: (v, value) => v.setTranslationX(value) },
|
|
@@ -29,6 +58,9 @@ export function createAndroidDriver() {
|
|
|
29
58
|
play(view, track, _startedAt, onEnd) {
|
|
30
59
|
const nativeView = view.nativeViewProtected;
|
|
31
60
|
const scale = unit(track.property);
|
|
61
|
+
if (track.property === 'rotateX' || track.property === 'rotateY') {
|
|
62
|
+
nativeView.setCameraDistance((view.perspective || 300) * Utils.layout.getDisplayDensity());
|
|
63
|
+
}
|
|
32
64
|
const keyframes = Array.create(android.animation.Keyframe, track.values.length);
|
|
33
65
|
track.values.forEach((value, i) => {
|
|
34
66
|
keyframes[i] = android.animation.Keyframe.ofFloat(track.times[i], value * scale);
|
|
@@ -36,6 +68,14 @@ export function createAndroidDriver() {
|
|
|
36
68
|
const holders = Array.create(android.animation.PropertyValuesHolder, 1);
|
|
37
69
|
holders[0] = android.animation.PropertyValuesHolder.ofKeyframe(nativeProperties[track.property], keyframes);
|
|
38
70
|
const animator = android.animation.ObjectAnimator.ofPropertyValuesHolder(nativeView, holders);
|
|
71
|
+
let cancelled = false;
|
|
72
|
+
let ended = false;
|
|
73
|
+
let started = false;
|
|
74
|
+
let restoreLayer;
|
|
75
|
+
const releaseLayer = () => {
|
|
76
|
+
restoreLayer?.();
|
|
77
|
+
restoreLayer = undefined;
|
|
78
|
+
};
|
|
39
79
|
animator.setDuration(Math.max(track.duration, 1));
|
|
40
80
|
animator.setStartDelay(track.delay);
|
|
41
81
|
animator.setInterpolator(interpolator);
|
|
@@ -48,26 +88,76 @@ export function createAndroidDriver() {
|
|
|
48
88
|
: android.animation.ValueAnimator.RESTART);
|
|
49
89
|
}
|
|
50
90
|
animator.addListener(new android.animation.Animator.AnimatorListener({
|
|
51
|
-
onAnimationStart() {
|
|
91
|
+
onAnimationStart() {
|
|
92
|
+
started = true;
|
|
93
|
+
if (!cancelled &&
|
|
94
|
+
!ended &&
|
|
95
|
+
track.property === 'opacity' &&
|
|
96
|
+
track.values.some((value) => value !== track.values[0]))
|
|
97
|
+
restoreLayer = fadeLayer(view, nativeView);
|
|
98
|
+
},
|
|
52
99
|
onAnimationRepeat() { },
|
|
53
|
-
onAnimationCancel() {
|
|
100
|
+
onAnimationCancel() {
|
|
101
|
+
cancelled = true;
|
|
102
|
+
releaseLayer();
|
|
103
|
+
},
|
|
54
104
|
onAnimationEnd() {
|
|
105
|
+
if (ended)
|
|
106
|
+
return;
|
|
107
|
+
ended = true;
|
|
108
|
+
releaseLayer();
|
|
55
109
|
onEnd();
|
|
56
110
|
},
|
|
57
111
|
}));
|
|
58
112
|
accessors[track.property].set(nativeView, track.values[0] * scale);
|
|
59
113
|
animator.start();
|
|
60
|
-
return
|
|
114
|
+
return {
|
|
115
|
+
elapsed: () => (started ? track.delay + animator.getCurrentPlayTime() : 0),
|
|
116
|
+
cancel() {
|
|
117
|
+
// Cancel before native callbacks: Android can send onStart while cancelling a delay.
|
|
118
|
+
cancelled = true;
|
|
119
|
+
releaseLayer();
|
|
120
|
+
animator.cancel();
|
|
121
|
+
},
|
|
122
|
+
};
|
|
61
123
|
},
|
|
62
124
|
stop(_view, handle) {
|
|
63
125
|
;
|
|
64
126
|
handle.cancel();
|
|
65
127
|
},
|
|
128
|
+
elapsed: (handle) => handle.elapsed(),
|
|
66
129
|
presented(view, property) {
|
|
67
130
|
const nativeView = view.nativeViewProtected;
|
|
68
131
|
return nativeView ? accessors[property].get(nativeView) / unit(property) : undefined;
|
|
69
132
|
},
|
|
70
|
-
after,
|
|
133
|
+
after(ms, callback) {
|
|
134
|
+
// A native marker follows animator duration scale, including changes during playback.
|
|
135
|
+
// Only completion crosses the bridge; there is no JavaScript update listener.
|
|
136
|
+
const values = Array.create('float', 2);
|
|
137
|
+
values[0] = 0;
|
|
138
|
+
values[1] = 1;
|
|
139
|
+
const marker = android.animation.ValueAnimator.ofFloat(values);
|
|
140
|
+
marker.setDuration(ms);
|
|
141
|
+
let active = true;
|
|
142
|
+
marker.addListener(new android.animation.Animator.AnimatorListener({
|
|
143
|
+
onAnimationStart() { },
|
|
144
|
+
onAnimationRepeat() { },
|
|
145
|
+
onAnimationCancel() {
|
|
146
|
+
active = false;
|
|
147
|
+
},
|
|
148
|
+
onAnimationEnd() {
|
|
149
|
+
if (!active)
|
|
150
|
+
return;
|
|
151
|
+
active = false;
|
|
152
|
+
callback();
|
|
153
|
+
},
|
|
154
|
+
}));
|
|
155
|
+
marker.start();
|
|
156
|
+
return () => {
|
|
157
|
+
active = false;
|
|
158
|
+
marker.cancel();
|
|
159
|
+
};
|
|
160
|
+
},
|
|
71
161
|
};
|
|
72
162
|
}
|
|
73
163
|
//# sourceMappingURL=android.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/driver/android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/driver/android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAA;AAWrD,iGAAiG;AACjG,SAAS,SAAS,CAAC,IAAU,EAAE,UAAsB;IACnD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,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