@design-llm/motion 1.0.3 → 1.0.5
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/README.md +127 -105
- package/dist/index.cjs +385 -193
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8725 -7150
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1,127 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @design-llm/motion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
精美的 React 动效组件库,提供丰富的动画效果组件。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
2. **递归触发**: 文件变更 -> 更新文件Header -> 更新所属文件夹MD -> (若影响全局) 更新主MD。
|
|
7
|
-
3. **分形自治**: 确保系统在任何一个子目录下,Agent都能通过该目录的MD重建局部世界观。
|
|
5
|
+
## 安装
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @design-llm/motion
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { BlurText, CircularText, ShinyText } from '@design-llm/motion';
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<BlurText text="Hello World" />
|
|
20
|
+
<CircularText text="Rotating Text" />
|
|
21
|
+
<ShinyText text="Shining Text" />
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 组件列表
|
|
28
|
+
|
|
29
|
+
### 文本动画
|
|
30
|
+
|
|
31
|
+
- **BlurText** - 模糊文本动画,文字从模糊到清晰逐个显示
|
|
32
|
+
- **CircularText** - 圆形旋转文字,文字沿圆形路径排列并旋转
|
|
33
|
+
- **ScrambledText** - 扰动文字效果,鼠标移动时字符随机变换
|
|
34
|
+
- **ShinyText** - 闪光文字动画,文字带有闪光扫过效果
|
|
10
35
|
|
|
11
|
-
|
|
36
|
+
### 边框动画
|
|
12
37
|
|
|
13
|
-
|
|
38
|
+
- **FlowingDashedBox** - 流动虚线边框,可配置方向、速度、颜色
|
|
39
|
+
- **ElectricBorder** - 电光边框,电光流动边框效果
|
|
14
40
|
|
|
15
|
-
###
|
|
16
|
-
- `/src/components`: **纯动效组件库**(只包含可复用的动效组件,如 BlurText、CircularText、ShinyText 等)
|
|
17
|
-
- `/src/lib`: 工具库(通用工具函数和组件导出入口)
|
|
18
|
-
- `/src/assets`: 静态资源(数据文件、图片等)
|
|
41
|
+
### 背景动画
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
- `/examples/pages`: 页面级组件(如首页)
|
|
23
|
-
- `/examples/components`: **网站展示组件**(如 homepage 组件、Navigation、SectionProvider 等,仅用于构建展示网站)
|
|
24
|
-
- `/examples/main-*.jsx`: 各种模式的入口文件
|
|
25
|
-
- `/examples/*.html`: HTML 入口文件
|
|
43
|
+
- **FallingPattern** - 下落图案背景,无限循环的粒子下落动画
|
|
44
|
+
- **BlackHole** - 黑洞可视化,基于 Three.js 的 3D 黑洞及吸积盘效果
|
|
26
45
|
|
|
27
|
-
|
|
46
|
+
### 按钮组件
|
|
28
47
|
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- **动效**: Framer Motion(实现复杂动效)
|
|
32
|
-
- **代码高亮**: react-syntax-highlighter
|
|
33
|
-
- **图标**: @ali/qoder-icon(待安装)
|
|
48
|
+
- **MetalButton** - 金属质感按钮,双层旋转金属渐变边框
|
|
49
|
+
- **LiquidMetalButton** - 液态金属按钮,液态流动金属质感按钮
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
### 卡片组件
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
- **纯动效组件**: 所有组件都是独立的、可复用的动效组件
|
|
39
|
-
- **无依赖展示代码**: npm 包中不包含任何网站展示相关的组件
|
|
40
|
-
- **TypeScript 支持**: 提供完整的类型定义
|
|
41
|
-
- **Tree-shaking 友好**: 支持按需导入
|
|
53
|
+
- **PixelCard** - 像素动画卡片,鼠标悬停时显示像素扩散效果
|
|
42
54
|
|
|
43
|
-
###
|
|
44
|
-
1. **Component Preview Card**: 卡片容器展示动效组件实时预览
|
|
45
|
-
2. **Code View**: 深色主题代码展示,支持复制
|
|
46
|
-
3. **Responsive Grid**: 响应式网格布局展示所有组件
|
|
47
|
-
4. **易于扩展**: 通过 ComponentWrapper 包裹新组件即可添加
|
|
55
|
+
### 3D 场景
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
- **Gallery3D** - 3D 画廊,3D 旋转画廊展示
|
|
58
|
+
- **Tunnel3D** - 3D 隧道,3D 隧道穿梭效果
|
|
59
|
+
- **ScrollCards3D** - 3D 滚动卡片,3D 滚动卡片堆叠效果
|
|
50
60
|
|
|
51
|
-
|
|
52
|
-
- `npm run dev` - 启动开发模式展示(端口 3000)
|
|
53
|
-
- `npm run dev:public` - 启动对外展示模式(端口 5174)
|
|
54
|
-
- `npm run dev:homepage` - 启动首页展示模式(端口 3001)
|
|
55
|
-
- `npm run build` - 构建开发模式
|
|
56
|
-
- `npm run build:public` - 构建对外展示模式
|
|
57
|
-
- `npm run build:homepage` - 构建首页展示模式
|
|
61
|
+
## 使用示例
|
|
58
62
|
|
|
59
|
-
###
|
|
60
|
-
- `npm run build:lib` - 构建 npm 包(输出到 `dist/` 目录)
|
|
61
|
-
- `npm run lint` - 代码检查
|
|
63
|
+
### BlurText
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
2. 在 `/src/lib/index.ts` 中导出新组件
|
|
66
|
-
3. 运行 `npm run build:lib` 构建库
|
|
67
|
-
4. 运行 `npm publish` 发布到 npm(会自动执行 `prepublishOnly` 钩子)
|
|
65
|
+
```jsx
|
|
66
|
+
import { BlurText } from '@design-llm/motion';
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
<BlurText
|
|
69
|
+
text="Hello World"
|
|
70
|
+
delay={200}
|
|
71
|
+
animateBy="words"
|
|
72
|
+
direction="top"
|
|
73
|
+
/>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### CircularText
|
|
70
77
|
|
|
78
|
+
```jsx
|
|
79
|
+
import { CircularText } from '@design-llm/motion';
|
|
80
|
+
|
|
81
|
+
<CircularText
|
|
82
|
+
text="Rotating Text"
|
|
83
|
+
spinDuration={10}
|
|
84
|
+
/>
|
|
71
85
|
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
│ │ ├── LiquidMetalButton.jsx # 液态金属按钮
|
|
84
|
-
│ │ ├── PixelCard.jsx # 像素动画卡片
|
|
85
|
-
│ │ ├── ElectricBorder.jsx # 电光边框
|
|
86
|
-
│ │ ├── Gallery3D.jsx # 3D画廊
|
|
87
|
-
│ │ ├── Tunnel3D.jsx # 3D隧道
|
|
88
|
-
│ │ └── ScrollCards3D.jsx # 3D滚动卡片
|
|
89
|
-
│ ├── lib/ # 工具库(导出入口)
|
|
90
|
-
│ │ ├── index.ts # 组件导出文件
|
|
91
|
-
│ │ └── remToPx.js # 工具函数
|
|
92
|
-
│ ├── assets/ # 静态资源
|
|
93
|
-
│ └── index.css # 全局样式(Tailwind)
|
|
94
|
-
│
|
|
95
|
-
├── examples/ # 🎨 展示目录(仅用于本地开发,不发布到 npm)
|
|
96
|
-
│ ├── showcase/ # 展示框架
|
|
97
|
-
│ │ ├── dev/ # 开发模式(完整展示)
|
|
98
|
-
│ │ │ └── components/ # 展示框架专用组件(Navigation, SectionProvider 等)
|
|
99
|
-
│ │ └── public/ # 对外模式(只显示使用代码)
|
|
100
|
-
│ ├── components/ # 网站展示组件(不发布到 npm)
|
|
101
|
-
│ │ ├── homepage/ # 首页专用组件
|
|
102
|
-
│ │ │ ├── AnimatedBackground.jsx
|
|
103
|
-
│ │ │ ├── HeroSection.jsx
|
|
104
|
-
│ │ │ ├── Timeline.jsx
|
|
105
|
-
│ │ │ └── ThemeToggle.jsx
|
|
106
|
-
│ │ ├── Navigation.jsx # 导航组件(展示网站用)
|
|
107
|
-
│ │ ├── SectionProvider.jsx # 滚动锚点管理(展示网站用)
|
|
108
|
-
│ │ └── Section.jsx # 锚点标记(展示网站用)
|
|
109
|
-
│ ├── pages/ # 页面级组件
|
|
110
|
-
│ │ └── HomePage.jsx # 首页组合组件
|
|
111
|
-
│ ├── main-dev.jsx # 开发模式入口
|
|
112
|
-
│ ├── main-homepage.jsx # 首页模式入口
|
|
113
|
-
│ ├── main-public.jsx # 对外模式入口
|
|
114
|
-
│ ├── index-dev.html # 开发模式 HTML
|
|
115
|
-
│ ├── index.html # 对外模式 HTML
|
|
116
|
-
│ ├── index-homepage.html # 首页模式 HTML
|
|
117
|
-
│ └── index.css # 展示用样式
|
|
118
|
-
│
|
|
119
|
-
├── dist/ # 📦 npm 包构建输出(通过 build:lib 生成)
|
|
120
|
-
├── dist-dev/ # 开发模式构建输出
|
|
121
|
-
├── dist-public/ # 对外模式构建输出
|
|
122
|
-
└── dist-homepage/ # 首页模式构建输出
|
|
86
|
+
|
|
87
|
+
### ShinyText
|
|
88
|
+
|
|
89
|
+
```jsx
|
|
90
|
+
import { ShinyText } from '@design-llm/motion';
|
|
91
|
+
|
|
92
|
+
<ShinyText
|
|
93
|
+
text="Shining Text"
|
|
94
|
+
speed={2}
|
|
95
|
+
direction="left"
|
|
96
|
+
/>
|
|
123
97
|
```
|
|
124
98
|
|
|
125
|
-
|
|
99
|
+
### MetalButton
|
|
100
|
+
|
|
101
|
+
```jsx
|
|
102
|
+
import { MetalButton } from '@design-llm/motion';
|
|
103
|
+
|
|
104
|
+
<MetalButton
|
|
105
|
+
onClick={() => console.log('clicked')}
|
|
106
|
+
size="md"
|
|
107
|
+
>
|
|
108
|
+
Click Me
|
|
109
|
+
</MetalButton>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### FlowingDashedBox
|
|
113
|
+
|
|
114
|
+
```jsx
|
|
115
|
+
import { FlowingDashedBox } from '@design-llm/motion';
|
|
116
|
+
|
|
117
|
+
<FlowingDashedBox
|
|
118
|
+
width={300}
|
|
119
|
+
height={200}
|
|
120
|
+
direction="right"
|
|
121
|
+
speed={2}
|
|
122
|
+
/>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### BlackHole
|
|
126
|
+
|
|
127
|
+
```jsx
|
|
128
|
+
import { BlackHole } from '@design-llm/motion';
|
|
129
|
+
|
|
130
|
+
<BlackHole
|
|
131
|
+
width={400}
|
|
132
|
+
height={400}
|
|
133
|
+
/>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## 依赖要求
|
|
137
|
+
|
|
138
|
+
- React 18+ 或 19+
|
|
139
|
+
- Tailwind CSS(所有组件高度依赖 Tailwind 类名)
|
|
140
|
+
- Framer Motion(已包含在依赖中)
|
|
141
|
+
|
|
142
|
+
## TypeScript 支持
|
|
143
|
+
|
|
144
|
+
本库提供完整的 TypeScript 类型定义,支持类型提示和类型检查。
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
MIT
|
|
126
149
|
|
|
127
|
-
一旦项目架构、技术栈或核心特性发生变化,必须立即更新此 README.md。
|