一些奇怪的更改

This commit is contained in:
2025-09-28 23:12:40 +08:00
parent b3a378bc79
commit d4af01a678
25 changed files with 5243 additions and 5072 deletions

View File

@@ -1,195 +1,195 @@
# 光标雨点效果使用指南
## 简介
这个博客已经集成了美丽的光标雨点效果!当你移动鼠标时,会在光标位置产生逼真的雨滴落下动画。
## 基础配置
### 1. 预设主题
`docs/.vitepress/theme/index.ts` 文件中,你可以选择不同的预设主题:
```typescript
// 默认蓝色主题(智能配置)
const config = getOptimalConfig()
// 或者手动选择预设:
const config = rainPresets.default // 默认
const config = rainPresets.light // 轻量模式(适合低性能设备)
const config = rainPresets.fancy // 华丽模式(更多雨滴)
const config = rainPresets.pink // 粉色主题
const config = rainPresets.green // 绿色主题
const config = rainPresets.gold // 金色主题
const config = rainPresets.mobile // 移动端优化
```
### 2. 自定义配置
你也可以完全自定义配置参数:
```typescript
const customConfig = {
maxDrops: 30, // 最大雨滴数量
color: 'rgba(255, 182, 193, 0.7)', // 雨滴颜色
duration: [1.0, 2.0], // 动画持续时间范围(秒)
dropSize: [3, 8], // 雨滴大小范围
delay: 100, // 鼠标移动到雨滴开始的延迟(毫秒)
zIndex: 1000, // 层级
enabled: true // 是否启用
}
const rainEffect = initCursorRainForVitePress(customConfig)
```
## 高级自定义
### 1. CSS 样式自定义
`docs/.vitepress/theme/cursor-rain-styles.css` 中,你可以自定义雨滴的视觉效果:
```css
/* 自定义雨滴样式 */
.cursor-rain-container .rain-drop {
/* 添加发光效果 */
box-shadow: 0 0 10px rgba(173, 216, 230, 0.6);
/* 添加模糊效果 */
filter: blur(1px);
/* 渐变背景 */
background: radial-gradient(circle,
rgba(173, 216, 230, 0.8) 0%,
rgba(173, 216, 230, 0.3) 70%,
transparent 100%);
}
```
### 2. 主题色彩
已经预设了多种主题色彩,包括:
- `blue` - 蓝色
- `lightBlue` - 浅蓝色
- `pink` - 粉色
- `green` - 绿色
- `gold` - 金色
- `purple` - 紫色
- `orange` - 橙色
- `red` - 红色
- `rainbow` - 彩虹色(特殊效果)
### 3. 动态控制
雨点效果实例已挂载到全局 `window.rainEffect`,你可以在浏览器控制台中动态控制:
```javascript
// 暂停效果
window.rainEffect.disable()
// 恢复效果
window.rainEffect.enable()
// 更新配置
window.rainEffect.updateOptions({
maxDrops: 50,
color: 'rgba(255, 99, 99, 0.8)'
})
// 切换主题(需要先导入 switchRainTheme 函数)
switchRainTheme(window.rainEffect, 'pink')
```
## 性能优化
### 1. 自动优化
系统会根据设备性能自动选择最佳配置:
- **移动设备**:自动使用移动端优化配置(更少雨滴,更长动画时间)
- **低性能设备**:自动使用轻量模式
- **高性能设备**:使用默认或华丽模式
### 2. 手动优化
如果遇到性能问题,可以手动调整:
```typescript
// 性能友好的配置
const performanceConfig = {
maxDrops: 10, // 减少雨滴数量
duration: [2.0, 3.0], // 增加动画时间
delay: 200, // 增加延迟
dropSize: [2, 4] // 减小雨滴尺寸
}
```
### 3. 移动端适配
CSS 中已包含移动端优化:
```css
@media (max-width: 768px) {
.cursor-rain-container .rain-drop {
/* 移动端减少视觉效果以提高性能 */
filter: none;
box-shadow: 0 0 4px rgba(173, 216, 230, 0.3);
}
}
```
## 常见问题
### Q: 如何完全禁用雨点效果?
A: 在配置中设置 `enabled: false`
```typescript
const config = {
...getOptimalConfig(),
enabled: false
}
```
### Q: 雨点效果影响性能怎么办?
A: 使用轻量模式:
```typescript
const config = rainPresets.light
```
或者手动减少雨滴数量:
```typescript
const config = {
...getOptimalConfig(),
maxDrops: 5
}
```
### Q: 如何在特定页面禁用效果?
A: 可以在页面的 frontmatter 中添加标识,然后在主题中根据路由判断是否启用。
### Q: 深色模式下雨点不明显怎么办?
A: CSS 中已包含深色模式适配,或者手动调整颜色:
```typescript
const config = {
...getOptimalConfig(),
color: 'rgba(173, 216, 230, 0.9)' // 增加透明度
}
```
## 开发调试
在开发过程中,你可以:
1. 打开浏览器控制台
2. 使用 `window.rainEffect` 实时调试
3. 修改配置后刷新页面查看效果
4. 使用 `window.rainEffect.updateOptions()` 实时更新配置
享受你的个性化光标雨点效果吧!🌧️✨
# 光标雨点效果使用指南
## 简介
这个博客已经集成了美丽的光标雨点效果!当你移动鼠标时,会在光标位置产生逼真的雨滴落下动画。
## 基础配置
### 1. 预设主题
`docs/.vitepress/theme/index.ts` 文件中,你可以选择不同的预设主题:
```typescript
// 默认蓝色主题(智能配置)
const config = getOptimalConfig()
// 或者手动选择预设:
const config = rainPresets.default // 默认
const config = rainPresets.light // 轻量模式(适合低性能设备)
const config = rainPresets.fancy // 华丽模式(更多雨滴)
const config = rainPresets.pink // 粉色主题
const config = rainPresets.green // 绿色主题
const config = rainPresets.gold // 金色主题
const config = rainPresets.mobile // 移动端优化
```
### 2. 自定义配置
你也可以完全自定义配置参数:
```typescript
const customConfig = {
maxDrops: 30, // 最大雨滴数量
color: 'rgba(255, 182, 193, 0.7)', // 雨滴颜色
duration: [1.0, 2.0], // 动画持续时间范围(秒)
dropSize: [3, 8], // 雨滴大小范围
delay: 100, // 鼠标移动到雨滴开始的延迟(毫秒)
zIndex: 1000, // 层级
enabled: true // 是否启用
}
const rainEffect = initCursorRainForVitePress(customConfig)
```
## 高级自定义
### 1. CSS 样式自定义
`docs/.vitepress/theme/cursor-rain-styles.css` 中,你可以自定义雨滴的视觉效果:
```css
/* 自定义雨滴样式 */
.cursor-rain-container .rain-drop {
/* 添加发光效果 */
box-shadow: 0 0 10px rgba(173, 216, 230, 0.6);
/* 添加模糊效果 */
filter: blur(1px);
/* 渐变背景 */
background: radial-gradient(circle,
rgba(173, 216, 230, 0.8) 0%,
rgba(173, 216, 230, 0.3) 70%,
transparent 100%);
}
```
### 2. 主题色彩
已经预设了多种主题色彩,包括:
- `blue` - 蓝色
- `lightBlue` - 浅蓝色
- `pink` - 粉色
- `green` - 绿色
- `gold` - 金色
- `purple` - 紫色
- `orange` - 橙色
- `red` - 红色
- `rainbow` - 彩虹色(特殊效果)
### 3. 动态控制
雨点效果实例已挂载到全局 `window.rainEffect`,你可以在浏览器控制台中动态控制:
```javascript
// 暂停效果
window.rainEffect.disable()
// 恢复效果
window.rainEffect.enable()
// 更新配置
window.rainEffect.updateOptions({
maxDrops: 50,
color: 'rgba(255, 99, 99, 0.8)'
})
// 切换主题(需要先导入 switchRainTheme 函数)
switchRainTheme(window.rainEffect, 'pink')
```
## 性能优化
### 1. 自动优化
系统会根据设备性能自动选择最佳配置:
- **移动设备**:自动使用移动端优化配置(更少雨滴,更长动画时间)
- **低性能设备**:自动使用轻量模式
- **高性能设备**:使用默认或华丽模式
### 2. 手动优化
如果遇到性能问题,可以手动调整:
```typescript
// 性能友好的配置
const performanceConfig = {
maxDrops: 10, // 减少雨滴数量
duration: [2.0, 3.0], // 增加动画时间
delay: 200, // 增加延迟
dropSize: [2, 4] // 减小雨滴尺寸
}
```
### 3. 移动端适配
CSS 中已包含移动端优化:
```css
@media (max-width: 768px) {
.cursor-rain-container .rain-drop {
/* 移动端减少视觉效果以提高性能 */
filter: none;
box-shadow: 0 0 4px rgba(173, 216, 230, 0.3);
}
}
```
## 常见问题
### Q: 如何完全禁用雨点效果?
A: 在配置中设置 `enabled: false`
```typescript
const config = {
...getOptimalConfig(),
enabled: false
}
```
### Q: 雨点效果影响性能怎么办?
A: 使用轻量模式:
```typescript
const config = rainPresets.light
```
或者手动减少雨滴数量:
```typescript
const config = {
...getOptimalConfig(),
maxDrops: 5
}
```
### Q: 如何在特定页面禁用效果?
A: 可以在页面的 frontmatter 中添加标识,然后在主题中根据路由判断是否启用。
### Q: 深色模式下雨点不明显怎么办?
A: CSS 中已包含深色模式适配,或者手动调整颜色:
```typescript
const config = {
...getOptimalConfig(),
color: 'rgba(173, 216, 230, 0.9)' // 增加透明度
}
```
## 开发调试
在开发过程中,你可以:
1. 打开浏览器控制台
2. 使用 `window.rainEffect` 实时调试
3. 修改配置后刷新页面查看效果
4. 使用 `window.rainEffect.updateOptions()` 实时更新配置
享受你的个性化光标雨点效果吧!🌧️✨

View File

@@ -1,204 +1,204 @@
# 🎛️ 光标雨点效果参数控制指南
## 📍 参数控制位置
### 1. **快速修改** - `docs/.vitepress/theme/index.ts`
直接在主题文件中自定义参数:
```typescript
// 完全自定义配置
const customConfig = {
maxDrops: 30, // 🌧️ 雨滴数量 (建议: 10-50)
color: 'rgba(173, 216, 230, 0.7)', // 🎨 颜色
duration: [1.0, 2.0], // ⏱️ 下落时间范围(秒)
dropSize: [3, 8], // 📏 雨滴大小范围(像素)
delay: 100, // ⏰ 鼠标移动延迟(毫秒)
zIndex: 1000, // 📐 层级
enabled: true // 🔄 是否启用
}
const rainEffect = initCursorRainForVitePress(customConfig)
```
### 2. **预设选择** - 使用现有预设
```typescript
// 选择预设
const config = rainPresets.fancy // 华丽模式
const config = rainPresets.light // 轻量模式
const config = rainPresets.pink // 粉色主题
const config = rainPresets.green // 绿色主题
const config = rainPresets.gold // 金色主题
```
### 3. **预设修改** - `docs/.vitepress/theme/cursor-rain-config.ts`
创建新预设或修改现有预设:
```typescript
export const rainPresets = {
// 添加你的自定义预设
myCustom: {
maxDrops: 35,
color: 'rgba(255, 100, 100, 0.8)',
duration: [0.8, 1.5],
dropSize: [2, 10],
delay: 80,
zIndex: 1000
} as RainDropOptions,
// 修改现有预设
default: {
maxDrops: 20, // 从25改为20
// ... 其他参数
}
}
```
## 🎯 详细参数说明
### 核心参数
| 参数 | 类型 | 默认值 | 说明 | 推荐范围 |
|------|------|--------|------|----------|
| `maxDrops` | number | 25 | 同时显示的最大雨滴数量 | 5-50 |
| `color` | string | 'rgba(173,216,230,0.6)' | 雨滴颜色(支持任何CSS颜色) | - |
| `duration` | [min,max] | [1.0, 2.0] | 下落时间范围(秒) | [0.5, 3.0] |
| `dropSize` | [min,max] | [3, 8] | 雨滴大小范围(像素) | [1, 15] |
| `delay` | number | 100 | 鼠标移动到雨滴出现的延迟(毫秒) | 50-300 |
### 高级参数
| 参数 | 说明 | 默认值 |
|------|------|--------|
| `zIndex` | 雨滴容器的层级 | 1000 |
| `enabled` | 是否启用效果 | true |
| `container` | 效果容器元素 | document.body |
## 🎨 视觉效果参数
### 雨滴形状控制 (CSS)
`docs/.vitepress/theme/cursor-rain-styles.css` 中:
```css
.cursor-rain-container .rain-drop {
/* 🔸 雨滴形状 - 数值越大越尖锐 */
border-radius: 50% 50% 50% 50% / 90% 90% 10% 10% !important;
/* 🌟 发光效果 */
box-shadow: 0 0 6px rgba(173, 216, 230, 0.4);
/* 🌫️ 模糊效果 */
filter: blur(0.5px);
}
```
### 雨滴尺寸控制 (JavaScript源码)
`cursor-rain/src/CursorRainEffect.ts` 中:
```javascript
// 第177-178行
width: size * 0.3, // 🔸 宽度倍数 (越小越细)
height: size * 4, // 🔸 高度倍数 (越大越长)
```
## 🚀 实时调试
### 浏览器控制台调试
```javascript
// 🔄 更新配置
window.rainEffect.updateOptions({
maxDrops: 50,
color: 'rgba(255, 99, 99, 0.8)',
duration: [0.5, 1.0]
})
// ⏸️ 暂停效果
window.rainEffect.disable()
// ▶️ 恢复效果
window.rainEffect.enable()
```
### 动态切换主题
```javascript
// 需要先导入switchRainTheme函数
import { switchRainTheme } from './cursor-rain-config'
// 🎨 切换颜色主题
switchRainTheme(window.rainEffect, 'pink')
switchRainTheme(window.rainEffect, 'green')
switchRainTheme(window.rainEffect, 'gold')
```
## 🎛️ 常用调整场景
### 🐌 性能优化 (减少卡顿)
```typescript
const performanceConfig = {
maxDrops: 10, // 减少数量
duration: [2.0, 3.0], // 增加时间
delay: 200, // 增加延迟
dropSize: [2, 4] // 减小尺寸
}
```
### 🌪️ 华丽效果 (更多雨滴)
```typescript
const fancyConfig = {
maxDrops: 50, // 增加数量
duration: [0.5, 1.2], // 减少时间
delay: 30, // 减少延迟
dropSize: [4, 12] // 增大尺寸
}
```
### 📱 移动端优化
```typescript
const mobileConfig = {
maxDrops: 8, // 大幅减少
duration: [2.5, 4.0], // 增加时间
delay: 300, // 增加延迟
dropSize: [2, 5] // 减小尺寸
}
```
### 🌈 彩色雨滴
```typescript
// 多种颜色随机
const colors = [
'rgba(255, 99, 99, 0.7)', // 红
'rgba(99, 255, 99, 0.7)', // 绿
'rgba(99, 99, 255, 0.7)', // 蓝
'rgba(255, 255, 99, 0.7)' // 黄
]
// 在JavaScript中需要修改源码来支持随机颜色
```
## 🔧 修改步骤
1. **选择修改方式**
- 简单调整 → 修改 `index.ts`
- 创建预设 → 修改 `cursor-rain-config.ts`
- 视觉效果 → 修改 `cursor-rain-styles.css`
- 深度定制 → 修改源码 `CursorRainEffect.ts`
2. **测试效果**
- 保存文件后VitePress会自动热重载
- 或在浏览器控制台实时调试
3. **优化性能**
- 移动端减少 `maxDrops`
- 低性能设备增加 `delay``duration`
享受你的个性化雨滴效果!🌧️✨
# 🎛️ 光标雨点效果参数控制指南
## 📍 参数控制位置
### 1. **快速修改** - `docs/.vitepress/theme/index.ts`
直接在主题文件中自定义参数:
```typescript
// 完全自定义配置
const customConfig = {
maxDrops: 30, // 🌧️ 雨滴数量 (建议: 10-50)
color: 'rgba(173, 216, 230, 0.7)', // 🎨 颜色
duration: [1.0, 2.0], // ⏱️ 下落时间范围(秒)
dropSize: [3, 8], // 📏 雨滴大小范围(像素)
delay: 100, // ⏰ 鼠标移动延迟(毫秒)
zIndex: 1000, // 📐 层级
enabled: true // 🔄 是否启用
}
const rainEffect = initCursorRainForVitePress(customConfig)
```
### 2. **预设选择** - 使用现有预设
```typescript
// 选择预设
const config = rainPresets.fancy // 华丽模式
const config = rainPresets.light // 轻量模式
const config = rainPresets.pink // 粉色主题
const config = rainPresets.green // 绿色主题
const config = rainPresets.gold // 金色主题
```
### 3. **预设修改** - `docs/.vitepress/theme/cursor-rain-config.ts`
创建新预设或修改现有预设:
```typescript
export const rainPresets = {
// 添加你的自定义预设
myCustom: {
maxDrops: 35,
color: 'rgba(255, 100, 100, 0.8)',
duration: [0.8, 1.5],
dropSize: [2, 10],
delay: 80,
zIndex: 1000
} as RainDropOptions,
// 修改现有预设
default: {
maxDrops: 20, // 从25改为20
// ... 其他参数
}
}
```
## 🎯 详细参数说明
### 核心参数
| 参数 | 类型 | 默认值 | 说明 | 推荐范围 |
|------|------|--------|------|----------|
| `maxDrops` | number | 25 | 同时显示的最大雨滴数量 | 5-50 |
| `color` | string | 'rgba(173,216,230,0.6)' | 雨滴颜色(支持任何CSS颜色) | - |
| `duration` | [min,max] | [1.0, 2.0] | 下落时间范围(秒) | [0.5, 3.0] |
| `dropSize` | [min,max] | [3, 8] | 雨滴大小范围(像素) | [1, 15] |
| `delay` | number | 100 | 鼠标移动到雨滴出现的延迟(毫秒) | 50-300 |
### 高级参数
| 参数 | 说明 | 默认值 |
|------|------|--------|
| `zIndex` | 雨滴容器的层级 | 1000 |
| `enabled` | 是否启用效果 | true |
| `container` | 效果容器元素 | document.body |
## 🎨 视觉效果参数
### 雨滴形状控制 (CSS)
`docs/.vitepress/theme/cursor-rain-styles.css` 中:
```css
.cursor-rain-container .rain-drop {
/* 🔸 雨滴形状 - 数值越大越尖锐 */
border-radius: 50% 50% 50% 50% / 90% 90% 10% 10% !important;
/* 🌟 发光效果 */
box-shadow: 0 0 6px rgba(173, 216, 230, 0.4);
/* 🌫️ 模糊效果 */
filter: blur(0.5px);
}
```
### 雨滴尺寸控制 (JavaScript源码)
`cursor-rain/src/CursorRainEffect.ts` 中:
```javascript
// 第177-178行
width: size * 0.3, // 🔸 宽度倍数 (越小越细)
height: size * 4, // 🔸 高度倍数 (越大越长)
```
## 🚀 实时调试
### 浏览器控制台调试
```javascript
// 🔄 更新配置
window.rainEffect.updateOptions({
maxDrops: 50,
color: 'rgba(255, 99, 99, 0.8)',
duration: [0.5, 1.0]
})
// ⏸️ 暂停效果
window.rainEffect.disable()
// ▶️ 恢复效果
window.rainEffect.enable()
```
### 动态切换主题
```javascript
// 需要先导入switchRainTheme函数
import { switchRainTheme } from './cursor-rain-config'
// 🎨 切换颜色主题
switchRainTheme(window.rainEffect, 'pink')
switchRainTheme(window.rainEffect, 'green')
switchRainTheme(window.rainEffect, 'gold')
```
## 🎛️ 常用调整场景
### 🐌 性能优化 (减少卡顿)
```typescript
const performanceConfig = {
maxDrops: 10, // 减少数量
duration: [2.0, 3.0], // 增加时间
delay: 200, // 增加延迟
dropSize: [2, 4] // 减小尺寸
}
```
### 🌪️ 华丽效果 (更多雨滴)
```typescript
const fancyConfig = {
maxDrops: 50, // 增加数量
duration: [0.5, 1.2], // 减少时间
delay: 30, // 减少延迟
dropSize: [4, 12] // 增大尺寸
}
```
### 📱 移动端优化
```typescript
const mobileConfig = {
maxDrops: 8, // 大幅减少
duration: [2.5, 4.0], // 增加时间
delay: 300, // 增加延迟
dropSize: [2, 5] // 减小尺寸
}
```
### 🌈 彩色雨滴
```typescript
// 多种颜色随机
const colors = [
'rgba(255, 99, 99, 0.7)', // 红
'rgba(99, 255, 99, 0.7)', // 绿
'rgba(99, 99, 255, 0.7)', // 蓝
'rgba(255, 255, 99, 0.7)' // 黄
]
// 在JavaScript中需要修改源码来支持随机颜色
```
## 🔧 修改步骤
1. **选择修改方式**
- 简单调整 → 修改 `index.ts`
- 创建预设 → 修改 `cursor-rain-config.ts`
- 视觉效果 → 修改 `cursor-rain-styles.css`
- 深度定制 → 修改源码 `CursorRainEffect.ts`
2. **测试效果**
- 保存文件后VitePress会自动热重载
- 或在浏览器控制台实时调试
3. **优化性能**
- 移动端减少 `maxDrops`
- 低性能设备增加 `delay``duration`
享受你的个性化雨滴效果!🌧️✨