跳转到正文
jolt.
← 动效配方

运动 / iOS / NATIVESCRIPT VUE

跟随每一刻。

一串弹簧,始终回应你的输入。

原生录屏 · iOSiOS 26 模拟器 · 真实 XCTest 输入与原生播放,原始速度。并非真机性能测试。

动效背后的代码。

Jolt 0.1.0-rc.11

直接来自指南的核心 API 示例。完整界面与控件请查看完整演示。

TypeScript · NativeScript
import { bind, motionScope, motionValue, set, springValue } from '@rafaelaugusto/jolt'

const scope = motionScope()
const pointer = motionValue(0)
const first = scope.add(springValue(pointer, { stiffness: 260, damping: 24 }))
const second = scope.add(springValue(first, { stiffness: 260, damping: 24 }))
scope.use(() => bind(cursor, { x: first }))
scope.use(() => bind(trailingCursor, { x: second }))

set(pointer, 180)
set(pointer, -40) // preserves each follower's position and velocity
// On page/component disposal:
scope.dispose()
查看完整示例 ↗

阅读完整指南 ↗