Skip to content

What Jolt is ​

Jolt brings motion to NativeScript apps and the Web: presets, springs, keyframes, stagger and gestures, with APIs for native views and HTML elements.

NativeScript ​

Animate native views on iOS and Android through the package's root entry:

ts
import { animate } from '@rafaelaugusto/jolt'

animate(card, 'fadeInUp')
animate(button, { scale: 1.1 }, 'bouncy')
animate(rows, 'fadeInUp', { stagger: 40 })

Web ​

Use @rafaelaugusto/jolt/web for HTML elements. It shares Jolt's motion compiler and uses the Web Animations API (WAAPI), without requiring NativeScript or a UI framework.

ts
import { createWebRuntime } from '@rafaelaugusto/jolt/web'

const motion = createWebRuntime(document)
const card = document.querySelector<HTMLElement>('.card')

if (card) {
  motion.animate(card, 'fadeInUp')
}

Create the runtime after browser mounting and call motion.dispose() when its application or component is torn down. The optional /web/vue adapter manages resources through Vue's lifecycle. The root import and /vue target NativeScript; they do not switch automatically to the DOM.

The Web APIs are experimental. Start with the Web runtime, then explore continuous motion, gestures and scroll, and gradients, loading and text. Each guide documents its supported targets and limits.

SwiftUI (Beta) ​

Available in 0.1.0-rc.18 (Beta) for iOS 17+ and macOS 14+, without NativeScript or JavaScript. Install the JoltSwiftUI product from the jolt-swift package repository, tag v0.1.0-rc.18. See installation, ownership and interaction/geometry for platform limits.

Why not view.animate() ​

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.

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. Default view tracks play without per-frame JavaScript. Real-size layout, opt-in subscriptions and gesture input have their own execution limits. Springs follow real physics, and an animation that interrupts another one starts from where the view is, at the speed it was going.

What it covers ​

The following guides cover NativeScript views. For HTML elements, use the Web guides above.

  • 25 presets to enter, exit and draw attention: fadeInUp, popIn, shake, heartbeat...

  • Springs described by feel (bouncy), by bounce and duration, or by stiffness, damping and mass.

  • Keyframes and tweens with an easing per segment and exact keyframe times.

  • Stagger across several views, from the first, the last or the center.

  • Sequences that start each step once the previous one looks done.

  • Press effects that follow the finger and let go when a scroll takes over.

  • Vue directives and a transition component from the optional @rafaelaugusto/jolt/vue entry.

  • Text entrances by letter or word on iOS and Android, keeping one accessible Label.

  • Interruptions that pick up the value and velocity on screen, with no jump.

  • Native playback: Core Animation on iOS and ObjectAnimator on Android for default view tracks; execution costs are documented per API.

  • Real dimensions: animate width, height and auto while text reflows and siblings move.

  • SceneKit camera field of view: coordinate perspective zoom with motion values on iOS.

Where to start ​

  1. Install Jolt and choose the entry for your platform.
  2. NativeScript: read Animating, then pick a transition or a preset.
  3. Web: start with the Web runtime or Vue DOM adapter.

Jolt is a release candidate; see installation for the published version. Both runtimes can be used directly, with optional framework integrations.

Reading the menu ​

The sidebar groups guides by topic, with dedicated sections for SwiftUI, the Web, examples and tools. Expand a group to browse its pages; the number next to its title is the page count. The group containing the current page opens automatically, including when you follow a direct link.

The sidebar highlights capabilities with three labels:

  • New: introduced in the documented edition.
  • Updated: a material change to an existing capability.
  • Beta: an experimental API or adapter whose contract may change.

New and Updated expire when the documented version changes. Beta stays until the API is stabilized. The label description distinguishes a published capability from a source candidate; the guide states any pending merge or publication. A badge alone does not mean a feature has been released.

Chromium on macOS, desktop viewport: topic groups, page counts, keyboard navigation, release badges and light/dark themes. Documentation navigation, not a native app.
Chromium on macOS, emulated mobile viewport: opening topic groups and following links by touch. Browser emulation, not a physical phone recording.

Released under the MIT License.