This handles the Skyline worklet animation system for WeChat mini-programs, letting you run animations directly on the UI thread instead of bouncing between threads and adding lag. You get SharedValues for cross-thread state, timing/spring/decay animations, and worklet functions that bypass the usual JS thread bottleneck. The mandatory rules are strict: every worklet needs the 'worklet' directive at the top, you must use .value to read SharedValues, and you have to wrap page methods with bind(this) when calling from runOnJS or things break. It's overkill for simple fades but essential for gesture-driven interactions like drag or scroll-based animations where frame timing matters.

skills.sh installs
1.1K
GitHub stars
56
last updated
Aug 21, 2026

Install

$ npx -y skills add wechat-miniprogram/skyline-skills --skill skyline-worklet --agent claude-code

Installs into .claude/skills of the current project.

Files

Worklet 动画系统

适用场景

  • 实现手势跟随、拖拽等交互动画
  • 使用 timing/spring/decay 创建动画效果
  • 通过 SharedValue 驱动节点样式变化
  • 组合多段动画(序列、重复、延迟)
  • 在 UI 线程和 JS 线程间传递数据

核心概念

双线程架构与 Worklet 的意义

小程序双线程架构中,UI 事件需跨线程传递到 JS 线程再回传,交互动画会有明显延迟。Worklet 动画让动画逻辑直接运行在 UI 线程,实现类原生动画体验。

三大核心概念

概念说明关键 API
worklet 函数可运行在 JS 或 UI 线程的函数,顶部声明 'worklet' 指令runOnUI(), runOnJS()
共享变量跨线程同步的变量,通过 .value 读写shared(), derived()
动画驱动将 SharedValue 绑定到节点样式applyAnimatedStyle()

基本流程

const { shared, timing } = wx.worklet

// 1. 创建共享变量
const offset = shared(0)

// 2. 绑定到节点样式(updater 为 worklet 函数)
this.applyAnimatedStyle('#box', () => {
  'worklet'
  return { transform: `translateX(${offset.value}px)` }
})

// 3. 修改值驱动动画
offset.value = timing(300, { duration: 200 })

文档索引

根据需求快速定位(路径相对于 references/):

Sponsors

Details

Repository
github.com/wechat-miniprogram/skyline-skills
Category
Java & JVM
First seen
Jun 3, 2026

More from wechat-miniprogram/skyline-skills

All 7

Recommended

More Java & JVM
1chrisbanes avatarcompose-stability-diagnosticschrisbanes/skillsUse when writing or reviewing Jetpack Compose parameter stability, compiler reports, skippability, unstable UI state classes, collection parameters, or Kotlin 2995skills.sh installs
2davila7 avatarcode-reviewerdavila7/claude-code-templatesComprehensive code review skill for TypeScript, JavaScript, Python, Swift, Kotlin, Go. Includes automated code analysis, best practice checking, security scanni975skills.sh installs
3andreev-danila avatarreanimated-skia-performanceandreev-danila/skillsWrite and review high-performance React Native animations and 2D graphics using react-native-reanimated (v4+) and @shopify/react-native-skia (Canvas scenes, run974skills.sh installs
4workos avatarworkos-widgetsworkos/skillsUse when the user is implementing, embedding, or debugging a WorkOS Widget — specifically the User Management, User Profile, Admin Portal SSO Connection, or Adm885skills.sh installs
5secondsky avatarsap-api-stylesecondsky/sap-skillsThis skill provides comprehensive guidance for documenting SAP APIs following the SAP API Style Guide standards. It should be used when creating or reviewing AP848skills.sh installs
6bitjaru avatarss-motionbitjaru/styleseedApply a named StyleSeed motion to a component — either one of the 5 personality seeds (Spring/Silk/Snap/Float/Pulse × entrance/exit/hover/press/layout) or a dis832skills.sh installs