Loading...
Loading...
Skyline custom route and page transition skills. It covers custom route animations (routeBuilder), preset routes (7 wx:// types), page back gestures, container transition animations (open-container), and Router API. It is suitable for implementing transition effects such as half-screen popups, page scaling, bottom pop-up, card expansion, etc. Trigger keywords: custom route, custom-route, routeBuilder, navigateTo, page transition, half screen, preset route, back gesture, open-container.
npx skill4agent add wechat-miniprogram/skyline-skills skyline-route| Level | Capability | Applicable Scenario |
|---|---|---|
| Preset Route | Use 7 built-in effects with one line of code | Quickly implement common transitions |
| Custom Route | Fully control animations via routeBuilder | Highly customized transitions |
| Container Transition | | Card expansion to detail page |
| Property | Description |
|---|---|
| primaryAnimation | Page entry/exit animation progress (0→1 for entry, 1→0 for exit) |
| secondaryAnimation | Animation progress of current page when the next page enters (synchronized with the primaryAnimation of the next page) |
| userGestureInProgress | Whether the current routing progress is controlled by gesture |
| startUserGesture / stopUserGesture | Gesture takes over/releases routing control |
| didPop | Confirm to return to the previous page |
references/| I want to... | Refer to Document |
|---|---|
| Understand custom route principles and interfaces | |
| View half-screen/gesture back code patterns | |
| Quickly use preset routes | |
| Configure page back gestures | |
| Implement card expansion transition | |
| View Router API | |
| Understand navigateTo routing parameters | |
| Listen to routing events | |
// ✅ Page A (Skyline) → Page B (Skyline): Custom route takes effect
// ❌ Page A (WebView) → Page B (Skyline): Degrade to default route// ✅ Correct
const handlePrimaryAnimation = () => {
'worklet'
return { transform: `translateX(${...}px)` }
}
// ❌ Incorrect: Missing worklet directive, cannot execute in UI thread
const handlePrimaryAnimation = () => {
return { transform: `translateX(${...}px)` }
}// ✅ Correct
handleDragStart() {
'worklet'
this.customRouteContext.startUserGesture()
}
handleDragEnd() {
'worklet'
// ... In animation completion callback:
stopUserGesture()
}// ✅ Correct: Call didPop after animation is completed
primaryAnimation.value = timing(0.0, { duration }, () => {
'worklet'
didPop()
stopUserGesture()
})<!-- ✅ Correct -->
<navigator url="/page">Click to jump</navigator>
<!-- ❌ Incorrect: Cannot nest ordinary nodes such as view -->
<navigator url="/page"><view>Jump</view></navigator>primaryAnimation.valuestartUserGestureprimaryAnimation.value| routeType | Effect | Minimum Basic Library Version |
|---|---|---|
| Bottom pop-up half screen | 3.1.0 |
| Full screen from bottom to top | 3.1.0 |
| Zoom in | 3.1.0 |
| iOS style modal | 3.1.0 |
| iOS modal embedded | 3.1.0 |
| Modal navigation | 3.1.0 |
| Modal popup | 3.1.0 |
// Use preset route
wx.navigateTo({
url: 'xxx',
routeType: 'wx://bottom-sheet',
routeOptions: { height: 60, round: true }
})| API | Description | Minimum Basic Library Version |
|---|---|---|
| Register custom route | 2.29.2 |
| Remove custom route | 2.29.2 |
| Get routing context | 2.29.2 |
| Jump with specified route type | 2.29.2 |
| Override routing configuration | 3.4.0 |
| Pass routing parameters | 3.4.0 |
| Container transition jump | 3.12.2 |
| Listen before routing execution | 3.5.5 |
| Listen after routing execution | 3.5.5 |
// Register: Slide in from right
wx.router.addRouteBuilder('slide', ({ primaryAnimation }) => {
const { windowWidth } = wx.getWindowInfo()
const handlePrimaryAnimation = () => {
'worklet'
const transX = windowWidth * (1 - primaryAnimation.value)
return { transform: `translateX(${transX}px)` }
}
return { handlePrimaryAnimation }
})
// Jump
wx.navigateTo({ url: 'pageB', routeType: 'slide' })| Scenario | Recommended Solution |
|---|---|
| Bottom pop-up half screen | Preset route |
| iOS style modal | Preset route |
| Custom half screen + gesture | Custom route + handlePrimaryAnimation |
| Card expansion to detail page | |
| Page fade-in effect | Custom route + opacity animation |
| Require vertical back gesture | |
| Scenario | Recommended Skill | Description |
|---|---|---|
| Animation development | | Worklet animation system (timing/spring/Easing) |
| Gesture processing | | gesture-handler gesture component |
| Shared element | | share-element cross-page animation |
| Configuration explanation | | app.json/page.json configuration |
| Overview migration | | Skyline overview and migration guide |
references/
├── api/
│ ├── navigate-to.md
│ ├── route-events.md
│ └── router-api.md
├── custom-route/
│ ├── custom-route-guide.md
│ └── route-patterns.md
├── open-container/
│ └── open-container.md
├── pop-gesture/
│ └── pop-gesture.md
└── preset-route/
└── preset-route.md