cineview 1.0.0
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/LICENSE +21 -0
- package/README.md +284 -0
- package/README.zh-CN.md +284 -0
- package/dist/animations/animationParser.d.ts +24 -0
- package/dist/animations/composer.d.ts +13 -0
- package/dist/animations/presets/blink.d.ts +18 -0
- package/dist/animations/presets/blur.d.ts +18 -0
- package/dist/animations/presets/bounce.d.ts +18 -0
- package/dist/animations/presets/elastic.d.ts +23 -0
- package/dist/animations/presets/fade.d.ts +18 -0
- package/dist/animations/presets/flip.d.ts +18 -0
- package/dist/animations/presets/index.d.ts +38 -0
- package/dist/animations/presets/rotate.d.ts +23 -0
- package/dist/animations/presets/shake.d.ts +28 -0
- package/dist/animations/presets/slide.d.ts +23 -0
- package/dist/animations/presets/special.d.ts +38 -0
- package/dist/animations/presets/zoom.d.ts +23 -0
- package/dist/animations/registry.d.ts +51 -0
- package/dist/artifacts.json +40 -0
- package/dist/blink-BGmsrTwW.mjs +81 -0
- package/dist/blur-CQoB_VWp.mjs +52 -0
- package/dist/bounce-B_QJxgOq.mjs +64 -0
- package/dist/cineview-dev.css +2 -0
- package/dist/cineview-dev.es.mjs +2 -0
- package/dist/cineview-drag.umd.js +2 -0
- package/dist/cineview-scroll.umd.js +2 -0
- package/dist/cineview.es.mjs +2 -0
- package/dist/cineview.umd.js +2 -0
- package/dist/components/Animate/Animate.d.ts +67 -0
- package/dist/components/Animate/AnimateRenderBridge.d.ts +16 -0
- package/dist/components/Animate/AnimateVideo.d.ts +59 -0
- package/dist/components/Animate/StaggerContainer.d.ts +35 -0
- package/dist/components/Animate/__fixtures__/animate-media-public-path.fixture.d.ts +1 -0
- package/dist/components/Animate/animateInterpolation.d.ts +41 -0
- package/dist/components/Animate/animateRenderState.d.ts +23 -0
- package/dist/components/Animate/animateSemantics.d.ts +39 -0
- package/dist/components/Animate/animateTimeline.d.ts +14 -0
- package/dist/components/Animate/dragVisualState.d.ts +26 -0
- package/dist/components/Animate/index.d.ts +6 -0
- package/dist/components/Animate/useAnimateArrival.d.ts +35 -0
- package/dist/components/Animate/useAnimateDrag.d.ts +34 -0
- package/dist/components/Animate/useAnimatePublicTimeline.d.ts +16 -0
- package/dist/components/Animate/useAnimateScroll.d.ts +83 -0
- package/dist/components/Animate/useAnimatedPropertyLanes.d.ts +30 -0
- package/dist/components/Animate/visibilityScheduler.d.ts +12 -0
- package/dist/components/CineView/CineView.d.ts +48 -0
- package/dist/components/CineView/CineViewDispatch.d.ts +2 -0
- package/dist/components/CineView/DirectScrollCineView.d.ts +5 -0
- package/dist/components/CineView/DragSceneStack.d.ts +55 -0
- package/dist/components/CineView/ScrollSceneSlot.d.ts +42 -0
- package/dist/components/CineView/ScrollSceneStack.d.ts +13 -0
- package/dist/components/CineView/ScrollbarOverlay.d.ts +24 -0
- package/dist/components/CineView/directScrollHelpers.d.ts +75 -0
- package/dist/components/CineView/index.d.ts +5 -0
- package/dist/components/CineView/preloadTargets.d.ts +18 -0
- package/dist/components/CineView/regroupCallbacks.d.ts +10 -0
- package/dist/components/CineView/useCineViewImperativeApi.d.ts +21 -0
- package/dist/components/CineView/useNativeScrollController.d.ts +38 -0
- package/dist/components/CineView/useScrollInputBindings.d.ts +9 -0
- package/dist/components/CineView/useScrollSceneLayout.d.ts +24 -0
- package/dist/components/CineView/useScrollSceneSnapshots.d.ts +32 -0
- package/dist/components/CineView/useScrollViewport.d.ts +20 -0
- package/dist/components/CineView/useScrollZoneRegistry.d.ts +34 -0
- package/dist/components/Container/Container.d.ts +2 -0
- package/dist/components/Container/index.d.ts +1 -0
- package/dist/components/Image/Image.d.ts +12 -0
- package/dist/components/Image/index.d.ts +2 -0
- package/dist/components/Position/Position.d.ts +13 -0
- package/dist/components/Position/index.d.ts +1 -0
- package/dist/components/Scene/Scene.d.ts +10 -0
- package/dist/components/Scene/SceneFixedLayer.d.ts +14 -0
- package/dist/components/Scene/__fixtures__/scene-grouped-public-path.fixture.d.ts +1 -0
- package/dist/components/Scene/dragPreparedState.d.ts +49 -0
- package/dist/components/Scene/helpers.d.ts +101 -0
- package/dist/components/Scene/index.d.ts +1 -0
- package/dist/components/Scene/sceneScrollBudget.d.ts +36 -0
- package/dist/components/Scene/sceneScrollRuntime.d.ts +66 -0
- package/dist/components/Scene/types.d.ts +189 -0
- package/dist/components/Scene/useDragSceneEngine.d.ts +67 -0
- package/dist/components/Scene/useElementTrack.d.ts +82 -0
- package/dist/components/Scene/useNativePointerDrag.d.ts +25 -0
- package/dist/components/Scene/useSceneAnimationRegistry.d.ts +56 -0
- package/dist/components/Scene/useScenePointerInput.d.ts +28 -0
- package/dist/components/Scene/useSceneRuntimeState.d.ts +17 -0
- package/dist/components/Scene/useSceneScrollTakeover.d.ts +14 -0
- package/dist/components/Scene/useScrollSceneEngine.d.ts +28 -0
- package/dist/components/runtime/runtimeContext.d.ts +14 -0
- package/dist/components/runtime/scrollExternalStore.d.ts +13 -0
- package/dist/components/runtime/scrollSceneFrameStore.d.ts +29 -0
- package/dist/context/CineViewContext.d.ts +25 -0
- package/dist/dev/PerfPanel.d.ts +16 -0
- package/dist/dev/index.d.ts +14 -0
- package/dist/dev/usePerfMonitor.d.ts +9 -0
- package/dist/drag-scene-engine-y8Wj9ivV.mjs +270 -0
- package/dist/elastic-CBP_FdRv.mjs +129 -0
- package/dist/element-track-Du10P12_.mjs +316 -0
- package/dist/entry-drag.d.ts +14 -0
- package/dist/entry-scroll.d.ts +14 -0
- package/dist/fade-DXxFsgxR.mjs +22 -0
- package/dist/flip-CrCoNIws.mjs +49 -0
- package/dist/hooks/imagePreloadCache.d.ts +4 -0
- package/dist/hooks/mediaPreloadCache.d.ts +31 -0
- package/dist/hooks/useFirstSceneEnter.d.ts +65 -0
- package/dist/hooks/useImagePreloader.d.ts +31 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/useSceneManager.d.ts +78 -0
- package/dist/index.d.ts +17 -0
- package/dist/media/VideoFrameRenderer.d.ts +48 -0
- package/dist/media/videoPlaybackOwnership.d.ts +63 -0
- package/dist/performance-monitor-AlOOwzY_.mjs +73 -0
- package/dist/public-api.d.ts +12 -0
- package/dist/rotate-BMEBKDk5.mjs +69 -0
- package/dist/scene-animation-registry-8b0m_IaZ.mjs +422 -0
- package/dist/shake-BV6SdR9O.mjs +171 -0
- package/dist/slide-DWmVtj0L.mjs +63 -0
- package/dist/special-DDz8BopB.mjs +224 -0
- package/dist/types/index.d.ts +555 -0
- package/dist/utils/animationHelpers.d.ts +15 -0
- package/dist/utils/debounce.d.ts +18 -0
- package/dist/utils/devLog.d.ts +16 -0
- package/dist/utils/dragTimelineMapping.d.ts +30 -0
- package/dist/utils/gestureDetector.d.ts +67 -0
- package/dist/utils/performanceMonitor.d.ts +66 -0
- package/dist/utils/styleConvert.d.ts +7 -0
- package/dist/utils/useIsomorphicLayoutEffect.d.ts +22 -0
- package/dist/utils/useStructurallyStableValue.d.ts +5 -0
- package/dist/zoom-CuAthpqd.mjs +63 -0
- package/package.json +167 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alien.mu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# CineView
|
|
2
|
+
|
|
3
|
+
[简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
[](https://react.dev/)
|
|
7
|
+

|
|
8
|
+
[](#verification)
|
|
9
|
+
[](#verification)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
CineView is a React framework for pages made of animated scenes. It handles dragging between scenes, animations that follow scrolling, and animation sequences within a scene. It also provides positioning in design coordinates, image preloading, and video controlled by animation progress.
|
|
13
|
+
|
|
14
|
+
The test and coverage badges refer to the local run recorded in [Verification](#verification).
|
|
15
|
+
|
|
16
|
+
[Install](#install) · [Run an example](#run-an-example) · [How it works](#how-it-works) · [Website and documentation](#website-and-documentation) · [Contributing](#contributing)
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
Install CineView 1.0.0 and its peer dependencies in a React application:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install cineview@1.0.0 react@19 react-dom@19 framer-motion@13
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
With pnpm:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add cineview@1.0.0 react@19 react-dom@19 framer-motion@13
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Applications supply React `^19.0.0`, React DOM `^19.0.0`, and Framer Motion `^13.0.0`. TypeScript declarations are included.
|
|
33
|
+
|
|
34
|
+
## Run an example
|
|
35
|
+
|
|
36
|
+
Use Node.js 22.22.1 or a newer 22.x release, or Node.js 24+, with pnpm 10.22.0. These are the repository's development requirements.
|
|
37
|
+
|
|
38
|
+
From this checkout:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm install --frozen-lockfile
|
|
42
|
+
pnpm build
|
|
43
|
+
pnpm --dir examples/minimal install --frozen-lockfile
|
|
44
|
+
pnpm --dir examples/minimal dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Open the address printed by Vite. The [minimal example](./examples/minimal) has three scenes and a button that restarts the page in the other navigation mode.
|
|
48
|
+
|
|
49
|
+
To test local package changes in another application, build and pack the checkout:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pnpm build
|
|
53
|
+
pnpm pack
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For an application next to the `cineview` checkout, install the generated archive and its peer dependencies:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm add ../cineview/cineview-1.0.0.tgz react@19 react-dom@19 framer-motion@13
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Adjust the archive path for your directories.
|
|
63
|
+
|
|
64
|
+
## A page with two scenes
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Animate, CineView, Scene } from 'cineview';
|
|
68
|
+
|
|
69
|
+
export default function App() {
|
|
70
|
+
return (
|
|
71
|
+
<CineView mode="drag" designWidth={750} a11y={{ label: 'Product tour' }}>
|
|
72
|
+
<Scene sceneId="opening">
|
|
73
|
+
<div style={{ height: '100%', display: 'grid', placeItems: 'center' }}>
|
|
74
|
+
<Animate enterAnimation="fade-in" duration={{ enter: 600 }}>
|
|
75
|
+
<h1>Start here</h1>
|
|
76
|
+
</Animate>
|
|
77
|
+
</div>
|
|
78
|
+
</Scene>
|
|
79
|
+
|
|
80
|
+
<Scene sceneId="details">
|
|
81
|
+
<div style={{ height: '100%', display: 'grid', placeItems: 'center' }}>
|
|
82
|
+
<Animate enterAnimation="slide-up" duration={{ enter: 800 }}>
|
|
83
|
+
<h2>Take a closer look</h2>
|
|
84
|
+
</Animate>
|
|
85
|
+
</div>
|
|
86
|
+
</Scene>
|
|
87
|
+
</CineView>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Drag vertically to change scenes. With the CineView container focused, the arrow keys, PageUp/PageDown, Home, and End also navigate. Buttons and inputs inside a scene keep their own keyboard handling.
|
|
93
|
+
|
|
94
|
+
## How it works
|
|
95
|
+
|
|
96
|
+
`CineView` selects the navigation mode. `Scene` groups content and defines its layout. `Animate` applies an animation to that content.
|
|
97
|
+
|
|
98
|
+
| Configuration | What controls the animation |
|
|
99
|
+
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
|
|
100
|
+
| `mode="drag"` with `timeline.driver: 'scene'` | The scene's element timeline follows the gesture and continues after release. |
|
|
101
|
+
| `mode="drag"` with `timeline.driver: 'clock'` | The animation plays by time after the scene arrives. |
|
|
102
|
+
| `mode="scroll"`, inside a `Scene.scroll` region, with `driver: 'scene'` | The region's real scroll position controls progress. |
|
|
103
|
+
| `mode="scroll"` outside a scroll region, or with `driver: 'clock'` | The animation plays by time when its element meets the visibility conditions. |
|
|
104
|
+
|
|
105
|
+
The default mode is `drag` and the default driver is `scene`. Mode and driver answer different questions: how the page moves, and how an element's animation advances.
|
|
106
|
+
|
|
107
|
+
A mode change starts a different engine. The [example](./examples/minimal/src/App.tsx) uses separate branches and a `key` to restart explicitly; it does not transfer progress between modes.
|
|
108
|
+
|
|
109
|
+
### Animation that follows scrolling
|
|
110
|
+
|
|
111
|
+
In scroll mode, scenes stay in document flow. Adding `Scene.scroll` creates a region that holds the scene in view while scrolling advances its animation:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { Animate, CineView, Scene } from 'cineview';
|
|
115
|
+
|
|
116
|
+
export default function ScrollPage() {
|
|
117
|
+
return (
|
|
118
|
+
<CineView mode="scroll" designWidth={750}>
|
|
119
|
+
<Scene sceneId="intro" layout={{ height: '100vh' }}>
|
|
120
|
+
<h1>A page that scrolls</h1>
|
|
121
|
+
</Scene>
|
|
122
|
+
|
|
123
|
+
<Scene
|
|
124
|
+
sceneId="detail"
|
|
125
|
+
layout={{ height: '100vh' }}
|
|
126
|
+
scroll={{ zoneId: 'detail', trigger: 'center-lock' }}
|
|
127
|
+
>
|
|
128
|
+
<Animate
|
|
129
|
+
enterAnimation={{
|
|
130
|
+
initial: { opacity: 0, y: 60 },
|
|
131
|
+
animate: { opacity: 1, y: 0 },
|
|
132
|
+
}}
|
|
133
|
+
duration={{ enter: 1600, exit: 0 }}
|
|
134
|
+
timeline={{ driver: 'scene' }}
|
|
135
|
+
>
|
|
136
|
+
<h2>Scroll to reveal the detail</h2>
|
|
137
|
+
</Animate>
|
|
138
|
+
</Scene>
|
|
139
|
+
</CineView>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
One millisecond of authored region duration corresponds to one CSS pixel of scroll travel. In this example, the animation spans 1,600 pixels. Scroll back to reverse it. The scene's visible height is separate from that animation distance.
|
|
145
|
+
|
|
146
|
+
A large input can stop at a region boundary; the next input continues. Wheel, touch, keyboard, and scrollbar input use the same scroll position. [Scroll behavior](./site/src/content/docs/en/scroll/01-centerlock.md) explains the bounds and zero-duration cases.
|
|
147
|
+
|
|
148
|
+
### Sequencing and repetition
|
|
149
|
+
|
|
150
|
+
Use `timeline.after` to connect animations in the same Scene, and `timeline.delay` to add a pause. For example, `timeline={{ after: 'heading', delay: 120 }}` starts after the animation named `heading`, with another 120 ms of delay.
|
|
151
|
+
|
|
152
|
+
`stagger={{ each: 110 }}` starts a container's direct children at timed intervals. Use separate Animate elements when each item needs its own progress controlled by scrolling.
|
|
153
|
+
|
|
154
|
+
`loopAnimation` repeats an effect while that animation is active. `exitAnimation` defines an optional exit. The [timeline guide](./site/src/content/docs/en/concepts/02-timeline.md) covers driver differences: drag animations with `driver: 'clock'` do not participate in `after` sequencing and ignore `exitAnimation`.
|
|
155
|
+
|
|
156
|
+
### Responsive coordinates
|
|
157
|
+
|
|
158
|
+
`designWidth` is the design's width in pixels; it defaults to `750`. Position coordinates and numeric Container lengths use:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
scale = viewport width / designWidth
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Both axes use this scale. CSS strings retain their units, and unitless values such as opacity are not scaled. Viewport height does not introduce another conversion factor. Use CSS breakpoints for text and layout that need to reflow; design-coordinate scaling alone does not provide a mobile reading layout.
|
|
165
|
+
|
|
166
|
+
## Components and extension points
|
|
167
|
+
|
|
168
|
+
| API | Purpose |
|
|
169
|
+
| -------------------- | -------------------------------------------------------------------------------------------------- |
|
|
170
|
+
| `CineView` | Navigation mode, shared configuration, callbacks, and navigation ref |
|
|
171
|
+
| `Scene` | Scene content, layout, asset declarations, and optional scroll region |
|
|
172
|
+
| `Animate` | Presets, custom property changes, parallel or sequential composition, and timing |
|
|
173
|
+
| `Position` | Coordinates and centering relative to the containing block; `fixed` keeps content within its Scene |
|
|
174
|
+
| `Container` | Convert layout lengths from design pixels |
|
|
175
|
+
| `Image` | Load an image through the shared preload cache |
|
|
176
|
+
| `AnimateVideo` | Seek video frames from animation progress or use normal playback |
|
|
177
|
+
| `useAnimateTimeline` | Read the nearest Animate's progress as MotionValues for custom DOM, SVG, or Canvas work |
|
|
178
|
+
|
|
179
|
+
A custom component can read progress without putting each frame into React state:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import { motion } from 'framer-motion';
|
|
183
|
+
import { useAnimateTimeline } from 'cineview';
|
|
184
|
+
|
|
185
|
+
export function ProgressLine() {
|
|
186
|
+
const { progress } = useAnimateTimeline();
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<motion.div
|
|
190
|
+
style={{
|
|
191
|
+
height: 4,
|
|
192
|
+
width: '100%',
|
|
193
|
+
background: '#d59273',
|
|
194
|
+
transformOrigin: 'left',
|
|
195
|
+
scaleX: progress,
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Render `ProgressLine` inside an `Animate`. The hook reads that Animate's timeline. Render-prop children are also available, but their progress updates render React; use the MotionValue hook for continuous drawing.
|
|
203
|
+
|
|
204
|
+
`ref.current.goToScene(index)` changes the scene. The ref also exposes `refreshLayout()`, `preload()`, `getCurrentIndex()`, and `getPerformanceMetrics()`. Scroll refs provide `goToZone()`. `onReady` supplies this API when it becomes available; use `preload()` to wait for declared asset loading.
|
|
205
|
+
|
|
206
|
+
Scene fixed content is clipped to its Scene. Put persistent site navigation outside CineView. See the [component reference](./site/src/content/docs/en/components/01-cineview.md) for configuration and callbacks.
|
|
207
|
+
|
|
208
|
+
## Package entry points
|
|
209
|
+
|
|
210
|
+
| Entry | Supported use |
|
|
211
|
+
| ------------------------ | -------------------------------------------------------------------------- |
|
|
212
|
+
| `cineview` | Main ESM and CommonJS entry, including both navigation engines |
|
|
213
|
+
| `cineview/drag` | CommonJS `require` and types for drag mode |
|
|
214
|
+
| `cineview/scroll` | CommonJS `require` and types for scroll mode |
|
|
215
|
+
| `cineview/dev` | Optional ESM development tools, including `PerfPanel` and `usePerfMonitor` |
|
|
216
|
+
| `cineview/dev/style.css` | Styles for the development panel |
|
|
217
|
+
|
|
218
|
+
Use `import { CineView } from 'cineview'` in an ESM application. The mode-specific subpaths have no ESM import condition. Browser script distributions are `cineview.umd.js`, `cineview-drag.umd.js`, and `cineview-scroll.umd.js`.
|
|
219
|
+
|
|
220
|
+
React, React DOM, and Framer Motion remain external peer dependencies. Development tools and their CSS are opt-in.
|
|
221
|
+
|
|
222
|
+
## Accessibility and motion preferences
|
|
223
|
+
|
|
224
|
+
The drag container supports keyboard navigation, a configurable accessible label, and scene-position announcements. Inactive drag scenes use `inert` and `aria-hidden`. Native controls inside scenes retain their normal interaction.
|
|
225
|
+
|
|
226
|
+
With `prefers-reduced-motion`, `loopAnimation` effects stop. Entrances and exits triggered by visibility changes jump to their final state. Animations controlled by dragging or scrolling still follow the input. Authored content still needs readable text, labels, and a usable focus order; a site's accessibility requires checking its complete content and interactions.
|
|
227
|
+
|
|
228
|
+
## Verification
|
|
229
|
+
|
|
230
|
+
Local framework run on **September 8, 2026**, using Node.js 22.22.1:
|
|
231
|
+
|
|
232
|
+
| Measure | Result |
|
|
233
|
+
| --------------------- | ------------ |
|
|
234
|
+
| Framework test suites | 118 passed |
|
|
235
|
+
| Framework tests | 1,582 passed |
|
|
236
|
+
| Statement coverage | 94.85% |
|
|
237
|
+
| Branch coverage | 90.22% |
|
|
238
|
+
| Function coverage | 95.15% |
|
|
239
|
+
| Line coverage | 96.27% |
|
|
240
|
+
|
|
241
|
+
The figures come from `pnpm test:coverage:framework`, which excludes site tests. The configured coverage minimum is 90% for each metric. Regenerate the snapshot after framework changes and before a release.
|
|
242
|
+
|
|
243
|
+
The [verification record](./VERIFICATION.md) records the commands, scope, and browser results. To run the checks:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
pnpm install --frozen-lockfile
|
|
247
|
+
pnpm --dir site install --frozen-lockfile
|
|
248
|
+
pnpm --dir examples/minimal install --frozen-lockfile
|
|
249
|
+
pnpm --dir examples/performance-test install --frozen-lockfile
|
|
250
|
+
|
|
251
|
+
pnpm verify:framework:static
|
|
252
|
+
pnpm type-check
|
|
253
|
+
pnpm type-check:site
|
|
254
|
+
pnpm test:site-contracts
|
|
255
|
+
pnpm docs:style:static
|
|
256
|
+
pnpm --dir site build
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
With Chrome available, `pnpm test:browser` runs the framework's browser checks. Static checks and coverage do not establish drag or scroll behavior on their own. The [CI workflow](./.github/workflows/ci.yml) defines Node.js 22.22.1 and 24.x checks; the [release workflow](./.github/workflows/release.yml) requires browser acceptance before publishing.
|
|
260
|
+
|
|
261
|
+
## Website and documentation
|
|
262
|
+
|
|
263
|
+
A public site URL has not been configured in this repository. Run the bilingual site locally:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
pnpm install --frozen-lockfile
|
|
267
|
+
pnpm --dir site install --frozen-lockfile
|
|
268
|
+
pnpm build
|
|
269
|
+
pnpm --dir site dev
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The default address is [http://localhost:4000](http://localhost:4000); use the address printed by Vite if the port is occupied. The [documentation](http://localhost:4000/docs) and [drag demo](http://localhost:4000/drag) are routes on that site.
|
|
273
|
+
|
|
274
|
+
Documentation source: [English](./site/src/content/docs/en) · [简体中文](./site/src/content/docs/zh). Both languages cover installation, concepts, drag and scroll behavior, components, and advanced use.
|
|
275
|
+
|
|
276
|
+
## Contributing
|
|
277
|
+
|
|
278
|
+
Read [CONTRIBUTING.md](./CONTRIBUTING.md) for the development workflow and [AGENTS.md](./AGENTS.md) for repository rules. Runtime changes need browser evidence in addition to unit tests. Keep the English and Chinese documentation aligned.
|
|
279
|
+
|
|
280
|
+
Report bugs through [GitHub issues](https://github.com/AlienMu/cineview/issues).
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
[MIT](./LICENSE), copyright Alien.mu.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# CineView
|
|
2
|
+
|
|
3
|
+
[English](./README.md)
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
[](https://react.dev/)
|
|
7
|
+

|
|
8
|
+
[](#验证)
|
|
9
|
+
[](#验证)
|
|
10
|
+
[](./LICENSE)
|
|
11
|
+
|
|
12
|
+
CineView 是一个用 React 编写分场景动画页面的框架。它支持拖动切换场景、让动画跟随滚动,以及在场景内安排动画顺序;也提供设计稿坐标定位、图片预加载和由动画进度控制的视频。
|
|
13
|
+
|
|
14
|
+
测试和覆盖率徽章对应[验证](#验证)中记录的本地运行结果。
|
|
15
|
+
|
|
16
|
+
[安装](#安装) · [运行示例](#运行示例) · [工作方式](#工作方式) · [站点与文档](#站点与文档) · [参与开发](#参与开发)
|
|
17
|
+
|
|
18
|
+
## 安装
|
|
19
|
+
|
|
20
|
+
在 React 应用中安装 CineView 1.0.0 和 peer 依赖:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install cineview@1.0.0 react@19 react-dom@19 framer-motion@13
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
使用 pnpm:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pnpm add cineview@1.0.0 react@19 react-dom@19 framer-motion@13
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
应用需提供 React `^19.0.0`、React DOM `^19.0.0` 和 Framer Motion `^13.0.0`。TypeScript 类型声明随包提供。
|
|
33
|
+
|
|
34
|
+
## 运行示例
|
|
35
|
+
|
|
36
|
+
仓库开发使用 Node.js 22.22.1 或更新的 22.x 版本,也支持 Node.js 24+;包管理器为 pnpm 10.22.0。
|
|
37
|
+
|
|
38
|
+
在当前仓库中运行:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm install --frozen-lockfile
|
|
42
|
+
pnpm build
|
|
43
|
+
pnpm --dir examples/minimal install --frozen-lockfile
|
|
44
|
+
pnpm --dir examples/minimal dev
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
打开 Vite 输出的地址。[最小示例](./examples/minimal)包含三个场景,可以通过按钮切换导航模式并重新开始。
|
|
48
|
+
|
|
49
|
+
要在其他应用中测试本地修改,先构建并打包:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pnpm build
|
|
53
|
+
pnpm pack
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
如果应用目录与 `cineview` 仓库同级,在应用中安装生成的包和 peer 依赖:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm add ../cineview/cineview-1.0.0.tgz react@19 react-dom@19 framer-motion@13
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
按实际目录调整安装包路径。
|
|
63
|
+
|
|
64
|
+
## 两个场景的页面
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { Animate, CineView, Scene } from 'cineview';
|
|
68
|
+
|
|
69
|
+
export default function App() {
|
|
70
|
+
return (
|
|
71
|
+
<CineView mode="drag" designWidth={750} a11y={{ label: 'Product tour' }}>
|
|
72
|
+
<Scene sceneId="opening">
|
|
73
|
+
<div style={{ height: '100%', display: 'grid', placeItems: 'center' }}>
|
|
74
|
+
<Animate enterAnimation="fade-in" duration={{ enter: 600 }}>
|
|
75
|
+
<h1>Start here</h1>
|
|
76
|
+
</Animate>
|
|
77
|
+
</div>
|
|
78
|
+
</Scene>
|
|
79
|
+
|
|
80
|
+
<Scene sceneId="details">
|
|
81
|
+
<div style={{ height: '100%', display: 'grid', placeItems: 'center' }}>
|
|
82
|
+
<Animate enterAnimation="slide-up" duration={{ enter: 800 }}>
|
|
83
|
+
<h2>Take a closer look</h2>
|
|
84
|
+
</Animate>
|
|
85
|
+
</div>
|
|
86
|
+
</Scene>
|
|
87
|
+
</CineView>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
上下拖动即可切换场景。聚焦 CineView 容器后,也能使用方向键、PageUp、PageDown、Home 和 End。场景里的按钮和输入框保留各自的键盘操作。
|
|
93
|
+
|
|
94
|
+
## 工作方式
|
|
95
|
+
|
|
96
|
+
`CineView` 选择页面的导航模式,`Scene` 组织内容并定义布局,`Animate` 为内容添加动画。
|
|
97
|
+
|
|
98
|
+
| 配置 | 动画如何推进 |
|
|
99
|
+
| ------------------------------------------------------------------- | -------------------------------------------- |
|
|
100
|
+
| `mode="drag"`,`timeline.driver: 'scene'` | 场景内的元素时间线跟随手势,释放后继续播放。 |
|
|
101
|
+
| `mode="drag"`,`timeline.driver: 'clock'` | 场景到达后,动画按时间播放。 |
|
|
102
|
+
| `mode="scroll"`,位于 `Scene.scroll` 区域中,使用 `driver: 'scene'` | 区域内的实际滚动位置控制进度。 |
|
|
103
|
+
| `mode="scroll"`,不在滚动区域中,或使用 `driver: 'clock'` | 元素满足可见性条件后,动画按时间播放。 |
|
|
104
|
+
|
|
105
|
+
默认模式是 `drag`,默认驱动是 `scene`。模式决定页面如何移动,驱动决定元素动画如何推进。
|
|
106
|
+
|
|
107
|
+
切换模式会使用另一套引擎。[示例](./examples/minimal/src/App.tsx)通过不同分支和 `key` 明确重新开始,不在两个模式之间传递原有进度。
|
|
108
|
+
|
|
109
|
+
### 让动画跟随滚动
|
|
110
|
+
|
|
111
|
+
scroll 模式中的场景按文档流排列。添加 `Scene.scroll` 后,场景会在指定区域内保持可见,由滚动推进动画:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { Animate, CineView, Scene } from 'cineview';
|
|
115
|
+
|
|
116
|
+
export default function ScrollPage() {
|
|
117
|
+
return (
|
|
118
|
+
<CineView mode="scroll" designWidth={750}>
|
|
119
|
+
<Scene sceneId="intro" layout={{ height: '100vh' }}>
|
|
120
|
+
<h1>A page that scrolls</h1>
|
|
121
|
+
</Scene>
|
|
122
|
+
|
|
123
|
+
<Scene
|
|
124
|
+
sceneId="detail"
|
|
125
|
+
layout={{ height: '100vh' }}
|
|
126
|
+
scroll={{ zoneId: 'detail', trigger: 'center-lock' }}
|
|
127
|
+
>
|
|
128
|
+
<Animate
|
|
129
|
+
enterAnimation={{
|
|
130
|
+
initial: { opacity: 0, y: 60 },
|
|
131
|
+
animate: { opacity: 1, y: 0 },
|
|
132
|
+
}}
|
|
133
|
+
duration={{ enter: 1600, exit: 0 }}
|
|
134
|
+
timeline={{ driver: 'scene' }}
|
|
135
|
+
>
|
|
136
|
+
<h2>Scroll to reveal the detail</h2>
|
|
137
|
+
</Animate>
|
|
138
|
+
</Scene>
|
|
139
|
+
</CineView>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
区域中声明的 1 毫秒动画时长对应 1 CSS 像素的滚动距离。本例的动画占 1,600 像素,向回滚动即可反向播放。场景本身的可见高度与这段动画距离分别计算。
|
|
145
|
+
|
|
146
|
+
大幅输入可能先停在区域边界,下一次输入继续前进。滚轮、触摸、键盘和滚动条操作都影响同一个滚动位置。[滚动说明](./site/src/content/docs/zh/scroll/01-centerlock.md)介绍了边界与零时长的行为。
|
|
147
|
+
|
|
148
|
+
### 顺序与循环
|
|
149
|
+
|
|
150
|
+
用 `timeline.after` 连接同一 Scene 内的动画,用 `timeline.delay` 增加间隔。例如,`timeline={{ after: 'heading', delay: 120 }}` 表示在名为 `heading` 的动画之后,再延迟 120 毫秒开始。
|
|
151
|
+
|
|
152
|
+
`stagger={{ each: 110 }}` 按时间间隔启动容器的直接子元素。如果每项都需要独立跟随滚动,使用各自的 Animate。
|
|
153
|
+
|
|
154
|
+
`loopAnimation` 在动画活动期间重复效果,`exitAnimation` 定义可选的退场。[时间线说明](./site/src/content/docs/zh/concepts/02-timeline.md)列出了不同驱动的差异:drag 模式中的 `driver: 'clock'` 不参与 `after` 编排,也不使用 `exitAnimation`。
|
|
155
|
+
|
|
156
|
+
### 响应式坐标
|
|
157
|
+
|
|
158
|
+
`designWidth` 是设计稿的像素宽度,默认值为 `750`。Position 坐标和 Container 的数值长度按以下比例换算:
|
|
159
|
+
|
|
160
|
+
```text
|
|
161
|
+
scale = viewport width / designWidth
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
横纵两个方向使用相同比例,不另按视口高度换算。CSS 字符串保留原有单位,透明度这类无单位数值也不会缩放。需要在手机上重新排列的文字和布局,仍需通过 CSS 断点处理。
|
|
165
|
+
|
|
166
|
+
## 组件与扩展
|
|
167
|
+
|
|
168
|
+
| API | 用途 |
|
|
169
|
+
| -------------------- | ---------------------------------------------------------------------------- |
|
|
170
|
+
| `CineView` | 导航模式、公共配置、回调和导航 ref |
|
|
171
|
+
| `Scene` | 场景内容、布局、资源声明和可选的滚动区域 |
|
|
172
|
+
| `Animate` | 预设、自定义属性变化、并行或顺序组合,以及时间配置 |
|
|
173
|
+
| `Position` | 相对包含块进行坐标定位和居中;`fixed` 内容限定在所属 Scene 内 |
|
|
174
|
+
| `Container` | 将布局长度从设计像素换算为实际尺寸 |
|
|
175
|
+
| `Image` | 通过共享预加载缓存加载图片 |
|
|
176
|
+
| `AnimateVideo` | 根据动画进度定位视频帧,或使用普通播放 |
|
|
177
|
+
| `useAnimateTimeline` | 以 MotionValue 读取最近一层 Animate 的进度,供自定义 DOM、SVG 或 Canvas 使用 |
|
|
178
|
+
|
|
179
|
+
自定义组件可以直接读取进度,不必将每一帧存入 React state:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import { motion } from 'framer-motion';
|
|
183
|
+
import { useAnimateTimeline } from 'cineview';
|
|
184
|
+
|
|
185
|
+
export function ProgressLine() {
|
|
186
|
+
const { progress } = useAnimateTimeline();
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<motion.div
|
|
190
|
+
style={{
|
|
191
|
+
height: 4,
|
|
192
|
+
width: '100%',
|
|
193
|
+
background: '#d59273',
|
|
194
|
+
transformOrigin: 'left',
|
|
195
|
+
scaleX: progress,
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
将 `ProgressLine` 放在 `Animate` 内部,它会读取该 Animate 的时间线。也可以使用 render-prop 子函数,但这种用法的进度更新会触发 React 渲染;连续绘制优先使用 MotionValue hook。
|
|
203
|
+
|
|
204
|
+
`ref.current.goToScene(index)` 切换场景。ref 还提供 `refreshLayout()`、`preload()`、`getCurrentIndex()` 和 `getPerformanceMetrics()`;scroll 模式另有 `goToZone()`。`onReady` 在这些 API 可用时提供引用;等待声明资源的加载过程则使用 `preload()`。
|
|
205
|
+
|
|
206
|
+
场景内的固定内容受 Scene 裁剪。需要跨场景保留的站点导航放在 CineView 外部。完整配置和回调见[组件参考](./site/src/content/docs/zh/components/01-cineview.md)。
|
|
207
|
+
|
|
208
|
+
## 包入口
|
|
209
|
+
|
|
210
|
+
| 入口 | 支持的用法 |
|
|
211
|
+
| ------------------------ | --------------------------------------------------------- |
|
|
212
|
+
| `cineview` | 主 ESM 和 CommonJS 入口,包含两种导航引擎 |
|
|
213
|
+
| `cineview/drag` | drag 模式的 CommonJS `require` 入口和类型 |
|
|
214
|
+
| `cineview/scroll` | scroll 模式的 CommonJS `require` 入口和类型 |
|
|
215
|
+
| `cineview/dev` | 可选的 ESM 开发工具,包含 `PerfPanel` 和 `usePerfMonitor` |
|
|
216
|
+
| `cineview/dev/style.css` | 开发面板样式 |
|
|
217
|
+
|
|
218
|
+
ESM 应用使用 `import { CineView } from 'cineview'`。两个模式子路径没有 ESM import 条件。浏览器脚本版本为 `cineview.umd.js`、`cineview-drag.umd.js` 和 `cineview-scroll.umd.js`。
|
|
219
|
+
|
|
220
|
+
React、React DOM 和 Framer Motion 都是外部 peer 依赖。开发工具和面板 CSS 按需引入。
|
|
221
|
+
|
|
222
|
+
## 无障碍与动态效果偏好
|
|
223
|
+
|
|
224
|
+
drag 容器支持键盘导航、可配置的无障碍名称和场景位置播报。非活动的 drag 场景使用 `inert` 和 `aria-hidden`,场景内的原生控件保留正常交互。
|
|
225
|
+
|
|
226
|
+
开启 `prefers-reduced-motion` 后,`loopAnimation` 效果停止。由元素可见性触发的入场和退场动画直接显示结束状态。拖动或滚动控制的动画仍跟随输入。页面内容仍需具备可读文字、控件名称和可用的焦点顺序;无障碍验收需要覆盖实际内容和完整交互。
|
|
227
|
+
|
|
228
|
+
## 验证
|
|
229
|
+
|
|
230
|
+
**2026 年 9 月 8 日**,使用 Node.js 22.22.1 运行框架检查:
|
|
231
|
+
|
|
232
|
+
| 指标 | 结果 |
|
|
233
|
+
| ------------ | ------------ |
|
|
234
|
+
| 框架测试套件 | 118 套通过 |
|
|
235
|
+
| 框架测试 | 1,582 项通过 |
|
|
236
|
+
| 语句覆盖率 | 94.85% |
|
|
237
|
+
| 分支覆盖率 | 90.22% |
|
|
238
|
+
| 函数覆盖率 | 95.15% |
|
|
239
|
+
| 行覆盖率 | 96.27% |
|
|
240
|
+
|
|
241
|
+
数据来自 `pnpm test:coverage:framework`,不包含站点测试。四项覆盖率的配置下限均为 90%。修改框架后和发布前,重新运行命令更新这些数据。
|
|
242
|
+
|
|
243
|
+
[验证记录](./VERIFICATION.md)包含命令、检查范围和浏览器结果。运行检查:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
pnpm install --frozen-lockfile
|
|
247
|
+
pnpm --dir site install --frozen-lockfile
|
|
248
|
+
pnpm --dir examples/minimal install --frozen-lockfile
|
|
249
|
+
pnpm --dir examples/performance-test install --frozen-lockfile
|
|
250
|
+
|
|
251
|
+
pnpm verify:framework:static
|
|
252
|
+
pnpm type-check
|
|
253
|
+
pnpm type-check:site
|
|
254
|
+
pnpm test:site-contracts
|
|
255
|
+
pnpm docs:style:static
|
|
256
|
+
pnpm --dir site build
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
安装 Chrome 后,`pnpm test:browser` 运行框架浏览器检查。静态检查和覆盖率本身不能证明拖动或滚动行为正确。[CI 配置](./.github/workflows/ci.yml)包含 Node.js 22.22.1 与 24.x 检查;[发布流程](./.github/workflows/release.yml)要求浏览器验收通过后再发布。
|
|
260
|
+
|
|
261
|
+
## 站点与文档
|
|
262
|
+
|
|
263
|
+
仓库尚未配置公开站点地址。可以在本地运行双语站点:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
pnpm install --frozen-lockfile
|
|
267
|
+
pnpm --dir site install --frozen-lockfile
|
|
268
|
+
pnpm build
|
|
269
|
+
pnpm --dir site dev
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
默认地址是 [http://localhost:4000](http://localhost:4000);端口被占用时,以 Vite 输出的地址为准。[文档](http://localhost:4000/docs)和[拖动演示](http://localhost:4000/drag)是同一站点中的页面。
|
|
273
|
+
|
|
274
|
+
文档源码:[English](./site/src/content/docs/en) · [简体中文](./site/src/content/docs/zh)。两种语言均包含安装、概念、拖动与滚动行为、组件和进阶用法。
|
|
275
|
+
|
|
276
|
+
## 参与开发
|
|
277
|
+
|
|
278
|
+
开发流程见 [CONTRIBUTING.md](./CONTRIBUTING.md),仓库规则见 [AGENTS.md](./AGENTS.md)。运行时改动除了单元测试,还需要浏览器证据。文档修改同步维护中英文版本。
|
|
279
|
+
|
|
280
|
+
通过 [GitHub issues](https://github.com/AlienMu/cineview/issues)提交问题。
|
|
281
|
+
|
|
282
|
+
## 许可证
|
|
283
|
+
|
|
284
|
+
[MIT](./LICENSE),著作权人 Alien.mu。
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CustomAnimation, ParsedAnimationVariant } from '../types';
|
|
2
|
+
export declare function normalizeParsedAnimationVariant(variant: ParsedAnimationVariant): ParsedAnimationVariant;
|
|
3
|
+
export declare const validateCustomAnimation: (animation: CustomAnimation) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Normalize a CustomAnimation into a Framer Motion variant subset.
|
|
6
|
+
*/
|
|
7
|
+
export declare const normalizeCustomAnimationVariant: (animation: CustomAnimation) => ParsedAnimationVariant;
|
|
8
|
+
export declare const convertWebAnimationToVariant: (animation: CustomAnimation) => ParsedAnimationVariant;
|
|
9
|
+
/**
|
|
10
|
+
* Parse preset animation by name
|
|
11
|
+
*/
|
|
12
|
+
export declare const parsePresetAnimation: (name: string) => Promise<ParsedAnimationVariant>;
|
|
13
|
+
/**
|
|
14
|
+
* Parse custom animation
|
|
15
|
+
*/
|
|
16
|
+
export declare const parseCustomAnimation: (animation: CustomAnimation) => ParsedAnimationVariant | null;
|
|
17
|
+
/**
|
|
18
|
+
* Parse animation (supports both preset and custom)
|
|
19
|
+
*/
|
|
20
|
+
export declare const parseAnimation: (animation: string | CustomAnimation) => Promise<ParsedAnimationVariant | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Create default animation (fallback when parsing fails)
|
|
23
|
+
*/
|
|
24
|
+
export declare const createDefaultAnimation: () => ParsedAnimationVariant;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComposedAnimation, CustomAnimation, ParsedAnimationVariant } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate composed animation configuration
|
|
4
|
+
*/
|
|
5
|
+
export declare const validateComposedAnimation: (animation: ComposedAnimation) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Compose animation
|
|
8
|
+
*/
|
|
9
|
+
export declare const composeAnimation: (animation: ComposedAnimation) => Promise<ParsedAnimationVariant | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Parse animation (supports preset, custom, and composed)
|
|
12
|
+
*/
|
|
13
|
+
export declare const parseAnimationWithComposition: (animation: string | CustomAnimation | ComposedAnimation) => Promise<ParsedAnimationVariant | null>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Variant } from 'framer-motion';
|
|
2
|
+
export declare const blinkAnimations: {
|
|
3
|
+
blink: {
|
|
4
|
+
initial: Variant;
|
|
5
|
+
animate: Variant;
|
|
6
|
+
exit: Variant;
|
|
7
|
+
};
|
|
8
|
+
flash: {
|
|
9
|
+
initial: Variant;
|
|
10
|
+
animate: Variant;
|
|
11
|
+
exit: Variant;
|
|
12
|
+
};
|
|
13
|
+
pulse: {
|
|
14
|
+
initial: Variant;
|
|
15
|
+
animate: Variant;
|
|
16
|
+
exit: Variant;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Variant } from 'framer-motion';
|
|
2
|
+
export declare const blurAnimations: {
|
|
3
|
+
'blur-in': {
|
|
4
|
+
initial: Variant;
|
|
5
|
+
animate: Variant;
|
|
6
|
+
exit: Variant;
|
|
7
|
+
};
|
|
8
|
+
'blur-out': {
|
|
9
|
+
initial: Variant;
|
|
10
|
+
animate: Variant;
|
|
11
|
+
exit: Variant;
|
|
12
|
+
};
|
|
13
|
+
'focus-in': {
|
|
14
|
+
initial: Variant;
|
|
15
|
+
animate: Variant;
|
|
16
|
+
exit: Variant;
|
|
17
|
+
};
|
|
18
|
+
};
|