Spaces:
Running
Running
反馈修改:伪字按笔画拆分、文字重叠修复、人物贴合山顶、重绘蛟龙、重做江海图
Browse files- README.md +2 -0
- quanxue-src/scripts/quanxue/shot.py +1 -1
- quanxue-src/src/App.tsx +2 -1
- quanxue-src/src/quanxue/dev.tsx +51 -0
- quanxue-src/src/quanxue/engine/draw.ts +15 -0
- quanxue-src/src/quanxue/scenes/dragon.ts +180 -0
- quanxue-src/src/quanxue/scenes/partA.ts +41 -30
- quanxue-src/src/quanxue/scenes/partB.ts +172 -69
- quanxue-src/src/quanxue/scenes/weiGlyph.ts +3 -0
- quanxue/assets/App-CDQjHgZN.js +0 -0
- quanxue/assets/quanxue-b6n75eFe.js +2 -0
- quanxue/index.html +1 -1
README.md
CHANGED
|
@@ -106,6 +106,8 @@ quanxue-src/
|
|
| 106 |
- Step 6:5 套原创封面 × 4:3 / 3:4 / 16:9 多选批量下载;小红书 / 抖音 / 视频号 / B站 各 3 个标题(实时字数校验)+ 描述 + 话题,一键复制;B站描述自动附章节时间戳。
|
| 107 |
- Step 7:手机竖屏适配(窄屏竖握自动切换 9:16 构图,旋转自动切换,全屏含 iOS 伪全屏、静音键下仍可出声);竖屏引文改为“小句不拆列”排版;字幕断句改为不跨句号/分号/冒号、超长小句均分;全片 37 个镜头 × 横竖屏逐帧质检(无越界、无报错);生产构建通过;线上页面播放与线上导出(H.264 + AAC)实测通过。
|
| 108 |
|
|
|
|
|
|
|
| 109 |
---
|
| 110 |
|
| 111 |
## 六、使用说明
|
|
|
|
| 106 |
- Step 6:5 套原创封面 × 4:3 / 3:4 / 16:9 多选批量下载;小红书 / 抖音 / 视频号 / B站 各 3 个标题(实时字数校验)+ 描述 + 话题,一键复制;B站描述自动附章节时间戳。
|
| 107 |
- Step 7:手机竖屏适配(窄屏竖握自动切换 9:16 构图,旋转自动切换,全屏含 iOS 伪全屏、静音键下仍可出声);竖屏引文改为“小句不拆列”排版;字幕断句改为不跨句号/分号/冒号、超长小句均分;全片 37 个镜头 × 横竖屏逐帧质检(无越界、无报错);生产构建通过;线上页面播放与线上导出(H.264 + AAC)实测通过。
|
| 108 |
|
| 109 |
+
- 反馈修改 1:①1:12“伪”字改为按字形真实笔画拆分(从字体轮廓中提取“亻”与“为”两组笔画),两部分向两侧分开后化为完整的“人”“为”;②3:24“外在的规范”移至圆环两侧,与“博学 · 向外求知”不再重叠;③3:40、3:59 山形改为峰顶恰在正中,人物双脚贴合峰顶;④重绘蛟龙(蛇形身躯、腹甲鳞纹、红色背鳍、四爪、鹿角龙首、长须、鬃毛尾焰,随行波游动),深潭增加崖壁、漩涡与气泡,并在解说“水积成渊,才会孕育蛟龙”时放大展示;⑤重做江海图:群山细流逐级汇合成江,喇叭口入海,海面为传统海水纹。新增“文字重叠检测”:全片每 0.5 秒 × 横竖屏共 1598 帧检测,另修复 0:45–0:51、0:58–1:00、4:57 三处此前未发现的文字重叠,现为 0 处重叠。
|
| 110 |
+
|
| 111 |
---
|
| 112 |
|
| 113 |
## 六、使用说明
|
quanxue-src/scripts/quanxue/shot.py
CHANGED
|
@@ -13,7 +13,7 @@ async def main():
|
|
| 13 |
logs = []
|
| 14 |
pg.on("console", lambda m: logs.append(m.text) if m.type in ("error", "warning") else None)
|
| 15 |
pg.on("pageerror", lambda e: logs.append("PAGEERR " + str(e)))
|
| 16 |
-
await pg.goto(f"http://localhost:5173/?still={ts}&o={o}" if ts != "audio" else "http://localhost:5173/?audiotest=1")
|
| 17 |
try:
|
| 18 |
await pg.wait_for_function("window.__done === true", timeout=300000)
|
| 19 |
except Exception as e:
|
|
|
|
| 13 |
logs = []
|
| 14 |
pg.on("console", lambda m: logs.append(m.text) if m.type in ("error", "warning") else None)
|
| 15 |
pg.on("pageerror", lambda e: logs.append("PAGEERR " + str(e)))
|
| 16 |
+
await pg.goto(f"http://localhost:5173/?still={ts}&o={o}" + ("&qa=text" if len(sys.argv) > 4 else "") if ts != "audio" else "http://localhost:5173/?audiotest=1")
|
| 17 |
try:
|
| 18 |
await pg.wait_for_function("window.__done === true", timeout=300000)
|
| 19 |
except Exception as e:
|
quanxue-src/src/App.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { PublishPanel } from './quanxue/ui/PublishPanel'
|
|
| 8 |
import { Transcript } from './quanxue/ui/Transcript'
|
| 9 |
import { DURATION, TL } from './quanxue/timeline'
|
| 10 |
import { fmtTime } from './quanxue/ui/store'
|
| 11 |
-
import { ExportTest, MusicDump, Still } from './quanxue/dev'
|
| 12 |
|
| 13 |
const isPhonePortrait = () => typeof window !== 'undefined' && window.matchMedia('(max-width: 820px) and (orientation: portrait)').matches
|
| 14 |
|
|
@@ -98,6 +98,7 @@ export default function App() {
|
|
| 98 |
if (location.search.includes('still=')) return <Still />
|
| 99 |
if (location.search.includes('musicdump')) return <MusicDump />
|
| 100 |
if (location.search.includes('exporttest')) return <ExportTest />
|
|
|
|
| 101 |
}
|
| 102 |
return <Main />
|
| 103 |
}
|
|
|
|
| 8 |
import { Transcript } from './quanxue/ui/Transcript'
|
| 9 |
import { DURATION, TL } from './quanxue/timeline'
|
| 10 |
import { fmtTime } from './quanxue/ui/store'
|
| 11 |
+
import { Ascii, ExportTest, MusicDump, Still } from './quanxue/dev'
|
| 12 |
|
| 13 |
const isPhonePortrait = () => typeof window !== 'undefined' && window.matchMedia('(max-width: 820px) and (orientation: portrait)').matches
|
| 14 |
|
|
|
|
| 98 |
if (location.search.includes('still=')) return <Still />
|
| 99 |
if (location.search.includes('musicdump')) return <MusicDump />
|
| 100 |
if (location.search.includes('exporttest')) return <ExportTest />
|
| 101 |
+
if (location.search.includes('ascii=')) return <Ascii />
|
| 102 |
}
|
| 103 |
return <Main />
|
| 104 |
}
|
quanxue-src/src/quanxue/dev.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
| 2 |
import { useEffect, useRef } from 'react'
|
| 3 |
import { loadFonts } from './fonts'
|
| 4 |
import { renderFrame } from './render'
|
|
|
|
| 5 |
|
| 6 |
export function Still() {
|
| 7 |
const ref = useRef<HTMLCanvasElement>(null)
|
|
@@ -19,8 +20,24 @@ export function Still() {
|
|
| 19 |
const stats: any[] = []
|
| 20 |
ts.forEach((t, i) => {
|
| 21 |
const t0 = performance.now()
|
|
|
|
| 22 |
renderFrame(tc, W, H, t)
|
| 23 |
const ms = performance.now() - t0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
if (i < 12) ctx.drawImage(tmp, 0, i * H)
|
| 25 |
const d = tc.getImageData(0, 0, W, H).data
|
| 26 |
let sum = 0, n = 0, x0 = W, y0 = H, x1 = 0, y1 = 0
|
|
@@ -74,3 +91,37 @@ export function ExportTest() {
|
|
| 74 |
}, [])
|
| 75 |
return <div>export test</div>
|
| 76 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import { useEffect, useRef } from 'react'
|
| 3 |
import { loadFonts } from './fonts'
|
| 4 |
import { renderFrame } from './render'
|
| 5 |
+
import { QA } from './engine/draw'
|
| 6 |
|
| 7 |
export function Still() {
|
| 8 |
const ref = useRef<HTMLCanvasElement>(null)
|
|
|
|
| 20 |
const stats: any[] = []
|
| 21 |
ts.forEach((t, i) => {
|
| 22 |
const t0 = performance.now()
|
| 23 |
+
if (q.get('qa') === 'text') QA.boxes = []
|
| 24 |
renderFrame(tc, W, H, t)
|
| 25 |
const ms = performance.now() - t0
|
| 26 |
+
if (QA.boxes) {
|
| 27 |
+
const bx = QA.boxes.map((b) => { const sx = (b.x1 - b.x0) * 0.14, sy = (b.y1 - b.y0) * 0.14; return { ...b, x0: b.x0 + sx, x1: b.x1 - sx, y0: b.y0 + sy, y1: b.y1 - sy } })
|
| 28 |
+
const hits: string[] = []
|
| 29 |
+
for (let i = 0; i < bx.length; i++) for (let j = i + 1; j < bx.length; j++) {
|
| 30 |
+
const A = bx[i], B = bx[j]
|
| 31 |
+
const ix = Math.min(A.x1, B.x1) - Math.max(A.x0, B.x0), iy = Math.min(A.y1, B.y1) - Math.max(A.y0, B.y0)
|
| 32 |
+
if (ix > 0 && iy > 0) {
|
| 33 |
+
const ar = Math.min((A.x1 - A.x0) * (A.y1 - A.y0), (B.x1 - B.x0) * (B.y1 - B.y0))
|
| 34 |
+
if (ix * iy > ar * 0.03) hits.push(`${A.s}|${B.s}`)
|
| 35 |
+
}
|
| 36 |
+
}
|
| 37 |
+
QA.boxes = null
|
| 38 |
+
stats.push({ t, hits: [...new Set(hits)].slice(0, 6) })
|
| 39 |
+
return
|
| 40 |
+
}
|
| 41 |
if (i < 12) ctx.drawImage(tmp, 0, i * H)
|
| 42 |
const d = tc.getImageData(0, 0, W, H).data
|
| 43 |
let sum = 0, n = 0, x0 = W, y0 = H, x1 = 0, y1 = 0
|
|
|
|
| 91 |
}, [])
|
| 92 |
return <div>export test</div>
|
| 93 |
}
|
| 94 |
+
|
| 95 |
+
export function Ascii() {
|
| 96 |
+
useEffect(() => {
|
| 97 |
+
(async () => {
|
| 98 |
+
await loadFonts()
|
| 99 |
+
const { drawDragon } = await import('./scenes/dragon')
|
| 100 |
+
const q = new URLSearchParams(location.search).get('ascii')
|
| 101 |
+
const W = 1200, H = 520
|
| 102 |
+
const cv = document.createElement('canvas'); cv.width = W; cv.height = H
|
| 103 |
+
const c = cv.getContext('2d', { willReadFrequently: true })!
|
| 104 |
+
c.fillStyle = '#000'; c.fillRect(0, 0, W, H)
|
| 105 |
+
if (q === 'dragon') drawDragon(c, 1000, 250, 820, 52, 1.3, 1)
|
| 106 |
+
else {
|
| 107 |
+
const { renderFrame } = await import('./render')
|
| 108 |
+
renderFrame(c, W, H * 1, Number(q))
|
| 109 |
+
}
|
| 110 |
+
const cols = 150, rows = 52, cw = W / cols, ch = H / rows
|
| 111 |
+
const d = c.getImageData(0, 0, W, H).data
|
| 112 |
+
const ramp = ' .:-=+*#%@'
|
| 113 |
+
let out = ''
|
| 114 |
+
for (let r = 0; r < rows; r++) {
|
| 115 |
+
for (let k = 0; k < cols; k++) {
|
| 116 |
+
let s = 0, n = 0
|
| 117 |
+
for (let y = Math.floor(r * ch); y < (r + 1) * ch; y += 2) for (let x = Math.floor(k * cw); x < (k + 1) * cw; x += 2) { const i = (y * W + x) * 4; s += 0.3 * d[i] + 0.59 * d[i + 1] + 0.11 * d[i + 2]; n++ }
|
| 118 |
+
out += ramp[Math.min(9, Math.floor((s / n / 255) * 10 * 1.4))]
|
| 119 |
+
}
|
| 120 |
+
out += '\n'
|
| 121 |
+
}
|
| 122 |
+
;(window as any).__stats = [out]
|
| 123 |
+
;(window as any).__done = true
|
| 124 |
+
})()
|
| 125 |
+
}, [])
|
| 126 |
+
return <div>ascii</div>
|
| 127 |
+
}
|
quanxue-src/src/quanxue/engine/draw.ts
CHANGED
|
@@ -238,6 +238,16 @@ export function bez(p0: [number, number], p1: [number, number], p2: [number, num
|
|
| 238 |
}
|
| 239 |
|
| 240 |
// ---------------- 文字 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
/** 单字显现:由虚到实、由大到正,如墨落纸面 */
|
| 242 |
export function revealChar(ctx: Ctx, ch: string, x: number, y: number, size: number, fam: string, color: string, r: number, alpha = 1) {
|
| 243 |
if (r <= 0 || alpha <= 0) return
|
|
@@ -251,6 +261,7 @@ export function revealChar(ctx: Ctx, ch: string, x: number, y: number, size: num
|
|
| 251 |
if (r < 1) { ctx.shadowColor = rgba(color, 0.8); ctx.shadowBlur = size * 0.25 * (1 - e) }
|
| 252 |
ctx.fillStyle = rgba(color, alpha * e)
|
| 253 |
ctx.fillText(ch, 0, size * 0.04)
|
|
|
|
| 254 |
ctx.restore()
|
| 255 |
}
|
| 256 |
|
|
@@ -259,6 +270,10 @@ export function text(ctx: Ctx, s: string, x: number, y: number, size: number, fa
|
|
| 259 |
ctx.font = font(size, fam, weight)
|
| 260 |
ctx.textAlign = align; ctx.textBaseline = 'middle'
|
| 261 |
ctx.fillStyle = rgba(color, alpha)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
if (spacing) {
|
| 263 |
try { (ctx as any).letterSpacing = `${spacing}px` } catch { /* ignore */ }
|
| 264 |
ctx.fillText(s, x + (align === 'center' ? spacing / 2 : 0), y)
|
|
|
|
| 238 |
}
|
| 239 |
|
| 240 |
// ---------------- 文字 ----------------
|
| 241 |
+
/** 质检:记录每段文字在屏幕上的包围盒(仅开发质检时启用) */
|
| 242 |
+
export const QA: { boxes: null | { s: string; x0: number; y0: number; x1: number; y1: number; a: number }[] } = { boxes: null }
|
| 243 |
+
function rec(ctx: Ctx, s: string, x: number, y: number, w: number, h: number, a: number) {
|
| 244 |
+
if (!QA.boxes) return
|
| 245 |
+
a *= ctx.globalAlpha
|
| 246 |
+
if (a < 0.25) return
|
| 247 |
+
const m = ctx.getTransform()
|
| 248 |
+
const pts = [[x, y], [x + w, y], [x, y + h], [x + w, y + h]].map(([px, py]) => [m.a * px + m.c * py + m.e, m.b * px + m.d * py + m.f])
|
| 249 |
+
QA.boxes.push({ s, x0: Math.min(...pts.map((p) => p[0])), y0: Math.min(...pts.map((p) => p[1])), x1: Math.max(...pts.map((p) => p[0])), y1: Math.max(...pts.map((p) => p[1])), a })
|
| 250 |
+
}
|
| 251 |
/** 单字显现:由虚到实、由大到正,如墨落纸面 */
|
| 252 |
export function revealChar(ctx: Ctx, ch: string, x: number, y: number, size: number, fam: string, color: string, r: number, alpha = 1) {
|
| 253 |
if (r <= 0 || alpha <= 0) return
|
|
|
|
| 261 |
if (r < 1) { ctx.shadowColor = rgba(color, 0.8); ctx.shadowBlur = size * 0.25 * (1 - e) }
|
| 262 |
ctx.fillStyle = rgba(color, alpha * e)
|
| 263 |
ctx.fillText(ch, 0, size * 0.04)
|
| 264 |
+
rec(ctx, ch, -size * 0.5, -size * 0.5, size, size, alpha * e)
|
| 265 |
ctx.restore()
|
| 266 |
}
|
| 267 |
|
|
|
|
| 270 |
ctx.font = font(size, fam, weight)
|
| 271 |
ctx.textAlign = align; ctx.textBaseline = 'middle'
|
| 272 |
ctx.fillStyle = rgba(color, alpha)
|
| 273 |
+
if (QA.boxes) {
|
| 274 |
+
const w = ctx.measureText(s).width + spacing * [...s].length
|
| 275 |
+
rec(ctx, s, align === 'center' ? x - w / 2 : align === 'right' || align === 'end' ? x - w : x, y - size * 0.5, w, size, alpha)
|
| 276 |
+
}
|
| 277 |
if (spacing) {
|
| 278 |
try { (ctx as any).letterSpacing = `${spacing}px` } catch { /* ignore */ }
|
| 279 |
ctx.fillText(s, x + (align === 'center' ? spacing / 2 : 0), y)
|
quanxue-src/src/quanxue/scenes/dragon.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 蛟龙:程序化绘制(蛇形躯干 + 腹甲鳞纹 + 背鳍 + 四爪 + 龙首鹿角长须 + 鬃毛尾焰),随行波游动
|
| 2 |
+
import { lerp, smooth } from '../engine/util'
|
| 3 |
+
import { rgba, type Ctx } from '../engine/draw'
|
| 4 |
+
|
| 5 |
+
const GOLD = '#d9ae5f', GOLD_D = '#9c7234', BELLY = '#f1dcaa', FIN = '#b8452f', INK = '#3d2812', HORN = '#efe2bf'
|
| 6 |
+
|
| 7 |
+
type V = [number, number]
|
| 8 |
+
const add = (a: V, b: V, k = 1): V => [a[0] + b[0] * k, a[1] + b[1] * k]
|
| 9 |
+
const norm = (v: V): V => { const l = Math.hypot(v[0], v[1]) || 1; return [v[0] / l, v[1] / l] }
|
| 10 |
+
const rot = (v: V, a: number): V => [v[0] * Math.cos(a) - v[1] * Math.sin(a), v[0] * Math.sin(a) + v[1] * Math.cos(a)]
|
| 11 |
+
|
| 12 |
+
/**
|
| 13 |
+
* @param hx,hy 龙首位置 @param L 身长 @param W0 最大身宽 @param t 时间 @param a 透明度
|
| 14 |
+
* 龙首朝右,身躯向左拖出
|
| 15 |
+
*/
|
| 16 |
+
export function drawDragon(c: Ctx, hx: number, hy: number, L: number, W0: number, t: number, a: number) {
|
| 17 |
+
if (a <= 0 || L <= 0) return
|
| 18 |
+
const N = 90
|
| 19 |
+
const A = W0 * 1.7
|
| 20 |
+
const P: V[] = [], T: V[] = [], Nn: V[] = [], Wd: number[] = []
|
| 21 |
+
for (let i = 0; i <= N; i++) {
|
| 22 |
+
const s = i / N
|
| 23 |
+
const amp = A * (0.25 + 0.75 * smooth(s / 0.3))
|
| 24 |
+
P.push([hx - s * L, hy + amp * Math.sin(Math.PI * 2 * 1.45 * s - t * 2.1) + W0 * 0.6 * Math.sin(t * 0.9) * (1 - s)])
|
| 25 |
+
}
|
| 26 |
+
for (let i = 0; i <= N; i++) {
|
| 27 |
+
const tg = norm([P[Math.min(N, i + 1)][0] - P[Math.max(0, i - 1)][0], P[Math.min(N, i + 1)][1] - P[Math.max(0, i - 1)][1]])
|
| 28 |
+
T.push(tg) // 由头指向尾
|
| 29 |
+
Nn.push([-tg[1], tg[0]]) // 背侧(朝上)
|
| 30 |
+
const s = i / N
|
| 31 |
+
Wd.push(W0 * Math.pow(Math.max(0, 1 - s), 0.72) * (0.78 + 0.22 * smooth((s - 0.03) / 0.18)))
|
| 32 |
+
}
|
| 33 |
+
const up = (i: number, k = 0.5) => add(P[i], Nn[i], Wd[i] * k)
|
| 34 |
+
const dn = (i: number, k = 0.5) => add(P[i], Nn[i], -Wd[i] * k)
|
| 35 |
+
const i0 = 3
|
| 36 |
+
c.save()
|
| 37 |
+
c.globalAlpha = a
|
| 38 |
+
c.lineJoin = 'round'; c.lineCap = 'round'
|
| 39 |
+
|
| 40 |
+
// ---- 腿 ----
|
| 41 |
+
const leg = (s: number, phase: number, far: boolean) => {
|
| 42 |
+
const i = Math.round(s * N)
|
| 43 |
+
const fwd: V = [-T[i][0], -T[i][1]]
|
| 44 |
+
const down: V = [-Nn[i][0], -Nn[i][1]]
|
| 45 |
+
const sw = Math.sin(t * 3 + phase) * 0.45
|
| 46 |
+
const hip = dn(i, 0.25)
|
| 47 |
+
const knee = add(hip, norm(add(down, fwd, far ? -0.6 + sw : 0.5 + sw)), W0 * 1.15)
|
| 48 |
+
const foot = add(knee, norm(add(fwd, down, 0.5 - sw * 0.5)), W0 * 0.95)
|
| 49 |
+
const col = far ? GOLD_D : GOLD
|
| 50 |
+
c.strokeStyle = rgba(INK, 0.9); c.lineWidth = W0 * 0.46
|
| 51 |
+
c.beginPath(); c.moveTo(hip[0], hip[1]); c.lineTo(knee[0], knee[1]); c.lineTo(foot[0], foot[1]); c.stroke()
|
| 52 |
+
c.strokeStyle = col; c.lineWidth = W0 * 0.36
|
| 53 |
+
c.beginPath(); c.moveTo(hip[0], hip[1]); c.lineTo(knee[0], knee[1]); c.lineTo(foot[0], foot[1]); c.stroke()
|
| 54 |
+
// 肘后飘毛
|
| 55 |
+
c.fillStyle = rgba(FIN, far ? 0.6 : 0.85)
|
| 56 |
+
const tuftDir = norm(add(T[i], down, 0.3))
|
| 57 |
+
c.beginPath(); c.moveTo(knee[0], knee[1]); c.quadraticCurveTo(...add(knee, tuftDir, W0 * 0.7) as [number, number], ...add(add(knee, tuftDir, W0 * 0.9), Nn[i], W0 * 0.3) as [number, number]); c.lineTo(...add(knee, down, W0 * 0.2) as [number, number]); c.closePath(); c.fill()
|
| 58 |
+
// 三爪
|
| 59 |
+
const fd = norm(add(fwd, down, 0.5 - sw * 0.5))
|
| 60 |
+
c.strokeStyle = rgba(HORN, 0.95); c.lineWidth = W0 * 0.1
|
| 61 |
+
for (const k of [-0.6, 0, 0.6]) {
|
| 62 |
+
const d = rot(fd, k)
|
| 63 |
+
const tip = add(foot, d, W0 * 0.42)
|
| 64 |
+
const hook = add(tip, rot(d, 1.4), W0 * 0.14)
|
| 65 |
+
c.beginPath(); c.moveTo(foot[0], foot[1]); c.lineTo(tip[0], tip[1]); c.lineTo(hook[0], hook[1]); c.stroke()
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
leg(0.2, 0, true); leg(0.6, 2.2, true)
|
| 69 |
+
|
| 70 |
+
// ---- 背鳍(红) ----
|
| 71 |
+
c.fillStyle = rgba(FIN, 0.95)
|
| 72 |
+
for (let i = Math.round(N * 0.07); i < N * 0.93; i += 3) {
|
| 73 |
+
const b1 = up(i, 0.42), b2 = up(Math.min(N, i + 3), 0.42)
|
| 74 |
+
const tip = add(add(up(i + 1, 0.5), Nn[i + 1], Wd[i] * 0.6), T[i], Wd[i] * 0.45)
|
| 75 |
+
c.beginPath(); c.moveTo(b1[0], b1[1]); c.quadraticCurveTo(tip[0] - T[i][0] * Wd[i] * 0.3, tip[1] - T[i][1] * Wd[i] * 0.3, tip[0], tip[1]); c.lineTo(b2[0], b2[1]); c.closePath(); c.fill()
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
// ---- 躯干 ----
|
| 79 |
+
c.beginPath()
|
| 80 |
+
for (let i = i0; i <= N; i++) { const q = up(i); i === i0 ? c.moveTo(q[0], q[1]) : c.lineTo(q[0], q[1]) }
|
| 81 |
+
for (let i = N; i >= i0; i--) { const q = dn(i); c.lineTo(q[0], q[1]) }
|
| 82 |
+
c.closePath()
|
| 83 |
+
c.fillStyle = GOLD; c.fill()
|
| 84 |
+
c.strokeStyle = rgba(INK, 0.9); c.lineWidth = Math.max(1, W0 * 0.07); c.stroke()
|
| 85 |
+
// 腹甲
|
| 86 |
+
c.beginPath()
|
| 87 |
+
for (let i = i0; i <= N; i++) { const q = dn(i, 0.08); i === i0 ? c.moveTo(q[0], q[1]) : c.lineTo(q[0], q[1]) }
|
| 88 |
+
for (let i = N; i >= i0; i--) { const q = dn(i, 0.47); c.lineTo(q[0], q[1]) }
|
| 89 |
+
c.closePath(); c.fillStyle = BELLY; c.fill()
|
| 90 |
+
c.strokeStyle = rgba(GOLD_D, 0.8); c.lineWidth = Math.max(0.8, W0 * 0.04)
|
| 91 |
+
for (let i = i0 + 1; i < N - 2; i += 2) { const p1 = dn(i, 0.08), p2 = dn(i, 0.47); c.beginPath(); c.moveTo(p1[0], p1[1]); c.lineTo(p2[0], p2[1]); c.stroke() }
|
| 92 |
+
// 鳞纹(指向龙首的 V 形)
|
| 93 |
+
c.strokeStyle = rgba(INK, 0.45); c.lineWidth = Math.max(0.7, W0 * 0.035)
|
| 94 |
+
for (let row = 0; row < 2; row++) {
|
| 95 |
+
for (let i = i0 + 2 + row; i < N - 3; i += 2) {
|
| 96 |
+
const k1 = row ? 0.0 : 0.3, k2 = row ? -0.08 : 0.22
|
| 97 |
+
const a1 = up(i + 1, k1 + 0.15), m = add(P[i], Nn[i], Wd[i] * k2), b1 = add(P[i + 1], Nn[i + 1], Wd[i + 1] * (k2 - 0.14))
|
| 98 |
+
c.beginPath(); c.moveTo(a1[0], a1[1]); c.quadraticCurveTo(m[0], m[1], b1[0], b1[1]); c.stroke()
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
leg(0.28, 1.1, false); leg(0.68, 3.3, false)
|
| 102 |
+
|
| 103 |
+
// ---- 尾焰 ----
|
| 104 |
+
const tail = P[N], td = T[N - 2]
|
| 105 |
+
c.fillStyle = rgba(FIN, 0.9)
|
| 106 |
+
for (const k of [-0.7, -0.2, 0.35]) {
|
| 107 |
+
const d = rot(td, k + Math.sin(t * 2.5 + k) * 0.2)
|
| 108 |
+
const tip = add(tail, d, W0 * 1.5)
|
| 109 |
+
const side = add(tail, rot(d, 0.5), W0 * 0.6)
|
| 110 |
+
c.beginPath(); c.moveTo(P[N - 4][0], P[N - 4][1]); c.quadraticCurveTo(side[0], side[1], tip[0], tip[1]); c.quadraticCurveTo(tail[0], tail[1], P[N - 2][0], P[N - 2][1]); c.closePath(); c.fill()
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
// ---- 龙首 ----
|
| 114 |
+
const h = W0 * 1.05
|
| 115 |
+
const head = P[0], hd: V = [-T[0][0], -T[0][1]]
|
| 116 |
+
const ang = Math.atan2(hd[1], hd[0])
|
| 117 |
+
c.save(); c.translate(head[0], head[1]); c.rotate(ang)
|
| 118 |
+
// 鬃毛
|
| 119 |
+
c.fillStyle = rgba(FIN, 0.95)
|
| 120 |
+
for (let k = 0; k < 6; k++) {
|
| 121 |
+
const bx = -k * 0.32 * h, wv = Math.sin(t * 3 + k) * 0.15 * h
|
| 122 |
+
c.beginPath(); c.moveTo(bx + 0.2 * h, -0.4 * h)
|
| 123 |
+
c.quadraticCurveTo(bx - 0.4 * h, -0.9 * h + wv, bx - 1.0 * h, -0.75 * h + wv)
|
| 124 |
+
c.quadraticCurveTo(bx - 0.4 * h, -0.45 * h, bx - 0.2 * h, -0.2 * h); c.closePath(); c.fill()
|
| 125 |
+
}
|
| 126 |
+
// 鹿角
|
| 127 |
+
c.strokeStyle = HORN; c.lineWidth = 0.14 * h
|
| 128 |
+
for (const off of [0, 0.22]) {
|
| 129 |
+
c.beginPath(); c.moveTo(0.25 * h, -0.42 * h); c.quadraticCurveTo(-0.3 * h, (-1.1 - off) * h, (-1.15 + off) * h, (-1.25 - off) * h); c.stroke()
|
| 130 |
+
c.beginPath(); c.moveTo((-0.35 + off) * h, (-0.95 - off * 0.6) * h); c.lineTo((-0.2 + off) * h, (-1.35 - off) * h); c.stroke()
|
| 131 |
+
}
|
| 132 |
+
// 下颌(开合)
|
| 133 |
+
const open = 0.16 + 0.1 * Math.sin(t * 2.2)
|
| 134 |
+
c.save(); c.translate(0.35 * h, 0.12 * h); c.rotate(open)
|
| 135 |
+
c.beginPath(); c.moveTo(0, 0); c.quadraticCurveTo(0.6 * h, 0.04 * h, 1.1 * h, 0.04 * h); c.quadraticCurveTo(0.7 * h, 0.36 * h, -0.05 * h, 0.34 * h); c.closePath()
|
| 136 |
+
c.fillStyle = GOLD_D; c.fill(); c.strokeStyle = rgba(INK, 0.9); c.lineWidth = Math.max(1, 0.06 * h); c.stroke()
|
| 137 |
+
c.fillStyle = '#fff6e0'
|
| 138 |
+
for (let k = 0; k < 4; k++) { const x = 0.25 * h + k * 0.2 * h; c.beginPath(); c.moveTo(x, 0.03 * h); c.lineTo(x + 0.06 * h, -0.1 * h); c.lineTo(x + 0.12 * h, 0.03 * h); c.closePath(); c.fill() }
|
| 139 |
+
// 须髯
|
| 140 |
+
c.fillStyle = rgba(HORN, 0.85)
|
| 141 |
+
c.beginPath(); c.moveTo(0.1 * h, 0.3 * h); c.quadraticCurveTo(-0.1 * h, 0.8 * h, -0.5 * h, 0.85 * h + Math.sin(t * 3) * 0.1 * h); c.quadraticCurveTo(-0.15 * h, 0.55 * h, -0.1 * h, 0.25 * h); c.closePath(); c.fill()
|
| 142 |
+
c.restore()
|
| 143 |
+
// 上颚与头颅
|
| 144 |
+
c.beginPath()
|
| 145 |
+
c.moveTo(-0.3 * h, -0.5 * h)
|
| 146 |
+
c.quadraticCurveTo(0.35 * h, -0.85 * h, 0.85 * h, -0.52 * h)
|
| 147 |
+
c.quadraticCurveTo(1.3 * h, -0.45 * h, 1.62 * h, -0.14 * h)
|
| 148 |
+
c.lineTo(1.6 * h, 0.06 * h)
|
| 149 |
+
c.quadraticCurveTo(1.0 * h, 0.08 * h, 0.35 * h, 0.14 * h)
|
| 150 |
+
c.quadraticCurveTo(0, 0.32 * h, -0.3 * h, 0.5 * h)
|
| 151 |
+
c.closePath()
|
| 152 |
+
c.fillStyle = GOLD; c.fill(); c.strokeStyle = rgba(INK, 0.9); c.lineWidth = Math.max(1, 0.06 * h); c.stroke()
|
| 153 |
+
// 上齿
|
| 154 |
+
c.fillStyle = '#fff6e0'
|
| 155 |
+
for (let k = 0; k < 4; k++) { const x = 0.55 * h + k * 0.22 * h; c.beginPath(); c.moveTo(x, 0.1 * h); c.lineTo(x + 0.06 * h, 0.24 * h); c.lineTo(x + 0.12 * h, 0.09 * h); c.closePath(); c.fill() }
|
| 156 |
+
// 眉骨、眼
|
| 157 |
+
c.strokeStyle = rgba(INK, 0.9); c.lineWidth = 0.08 * h
|
| 158 |
+
c.beginPath(); c.moveTo(0.45 * h, -0.55 * h); c.quadraticCurveTo(0.8 * h, -0.72 * h, 1.05 * h, -0.5 * h); c.stroke()
|
| 159 |
+
c.fillStyle = '#fff1c4'; c.beginPath(); c.ellipse(0.78 * h, -0.38 * h, 0.13 * h, 0.09 * h, -0.2, 0, Math.PI * 2); c.fill()
|
| 160 |
+
c.fillStyle = '#b3261e'; c.beginPath(); c.arc(0.82 * h, -0.38 * h, 0.055 * h, 0, Math.PI * 2); c.fill()
|
| 161 |
+
// 鼻卷
|
| 162 |
+
c.strokeStyle = rgba(INK, 0.9); c.lineWidth = 0.06 * h
|
| 163 |
+
c.beginPath(); c.arc(1.42 * h, -0.2 * h, 0.08 * h, Math.PI * 0.2, Math.PI * 1.7); c.stroke()
|
| 164 |
+
// 长须
|
| 165 |
+
c.strokeStyle = rgba(HORN, 0.9); c.lineWidth = Math.max(1, 0.06 * h)
|
| 166 |
+
for (const side of [-1, 1]) {
|
| 167 |
+
c.beginPath(); c.moveTo(1.45 * h, -0.08 * h)
|
| 168 |
+
for (let k = 1; k <= 24; k++) {
|
| 169 |
+
const q = k / 24
|
| 170 |
+
const x = lerp(1.45 * h, -2.6 * h, q)
|
| 171 |
+
const y = -0.08 * h + side * q * 0.9 * h + Math.sin(q * 7 - t * 3 + side) * 0.25 * h * q
|
| 172 |
+
c.lineTo(x, y)
|
| 173 |
+
}
|
| 174 |
+
c.stroke()
|
| 175 |
+
}
|
| 176 |
+
c.restore()
|
| 177 |
+
c.restore()
|
| 178 |
+
return P
|
| 179 |
+
}
|
| 180 |
+
|
quanxue-src/src/quanxue/scenes/partA.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
// 场景(上):片头、章节卡、其人其书、思想底色、学不可以已
|
| 2 |
import type { SceneCtx } from '../render'
|
|
|
|
| 3 |
import { TL } from '../timeline'
|
| 4 |
import { clamp, easeIn, easeInOut, easeOut, easeOutBack, easeOutExpo, fbm1, hash, lerp, noise1, ramp, rng, smooth, win, type Rect } from '../engine/util'
|
| 5 |
import { COL, F, bez, brush, dust, font, frame, glow, hairline, inkBlob, mountains, revealChar, rgba, seal, stamp, text, vtext, type Ctx } from '../engine/draw'
|
|
@@ -43,6 +44,8 @@ export function enso(c: Ctx, x: number, y: number, R: number, p: number, color:
|
|
| 43 |
}
|
| 44 |
|
| 45 |
const CH_KEY = ['荀', '性', '学', '假', '积', '止']
|
|
|
|
|
|
|
| 46 |
|
| 47 |
export const partA: Record<string, Scene> = {
|
| 48 |
// ---------- 片头 ----------
|
|
@@ -181,8 +184,8 @@ export const partA: Record<string, Scene> = {
|
|
| 181 |
const rows = P ? 2 : 1, per = 32 / rows
|
| 182 |
const totalW = (P ? 0.9 : 0.86) * W
|
| 183 |
const sw = (totalW / per) * 0.74, gap = totalW / per
|
| 184 |
-
const sh = P ? H * 0.
|
| 185 |
-
const top = P ? H * 0.
|
| 186 |
const focus = ramp(lt, kq - 0.2, 0.9)
|
| 187 |
for (let j = 0; j < 32; j++) {
|
| 188 |
const row = Math.floor(j / per), col = j % per
|
|
@@ -214,8 +217,8 @@ export const partA: Record<string, Scene> = {
|
|
| 214 |
c.beginPath(); c.moveTo(W / 2 - totalW / 2, y + sh * f); c.lineTo(W / 2 + totalW / 2, y + sh * f); c.stroke()
|
| 215 |
}
|
| 216 |
}
|
| 217 |
-
const by = P ? top + 2 * sh + H * 0.
|
| 218 |
-
text(c, '《荀子》 三十二篇', W / 2, by, 44 * u, F.kai, COL.paper, ramp(lt, k0, 0.8) * (1 -
|
| 219 |
text(c, '西汉 刘向 校定 · 劝学居首', W / 2, by + 52 * u, 22 * u, F.song, COL.muted, ramp(lt, k0 + 1, 0.8) * (1 - ramp(lt, kd - 1.5, 1)), 'center', 6 * u)
|
| 220 |
const da = ramp(lt, kd - 0.3, 0.8)
|
| 221 |
if (da > 0) {
|
|
@@ -239,7 +242,6 @@ export const partA: Record<string, Scene> = {
|
|
| 239 |
const s2 = bez([cxp - s * 0.04, cyp - s * 0.1], [cxp + s * 0.12, cyp + s * 0.3], [cxp + s * 0.5, cyp + s * 0.44])
|
| 240 |
brush(c, s1, s * 0.15, easeInOut(ramp(lt, 0.4, 1.0)), COL.paper, 0.95, 3, 0.7)
|
| 241 |
brush(c, s2, s * 0.17, easeInOut(ramp(lt, 1.25, 1.0)), COL.paper, 0.95, 7, 0.7)
|
| 242 |
-
text(c, '人', cxp, cyp + s * 0.72, 26 * u, F.song, COL.gold, ramp(lt, 2.2, 1) * (hasQ ? 0 : 1), 'center', 8 * u)
|
| 243 |
text(c, '荀子如何看“人”?', cxp, cyp + s * 0.72, 30 * u, F.song, COL.gold, ramp(lt, 2.2, 1) * (1 - shift), 'center', 8 * u)
|
| 244 |
},
|
| 245 |
},
|
|
@@ -247,35 +249,41 @@ export const partA: Record<string, Scene> = {
|
|
| 247 |
wei: {
|
| 248 |
draw(S) {
|
| 249 |
const { c, W, H, u, P, lt } = S
|
| 250 |
-
const size = Math.min(W, H) * 0.
|
| 251 |
-
const X = W / 2, Y =
|
| 252 |
const kx = S.k('c2l3', '不是虚伪'), kr = S.k('c2l3', '而是'), kh = S.k('c2l3', '后天')
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
const
|
| 256 |
-
|
| 257 |
-
const
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
// 虚伪 ✗
|
| 266 |
const xa = win(lt, kx - 0.1, kr + 0.4, 0.4)
|
| 267 |
if (xa > 0) {
|
| 268 |
-
const qx = P ? X : X + size *
|
| 269 |
text(c, '虚伪', qx, qy, 48 * u, F.kai, COL.muted, xa, 'center', 6 * u)
|
| 270 |
c.strokeStyle = rgba(COL.red, xa); c.lineWidth = 4 * u
|
| 271 |
c.beginPath(); c.moveTo(qx - 60 * u, qy + 4 * u); c.lineTo(qx - 60 * u + 120 * u * ramp(lt, kx + 0.5, 0.4), qy - 4 * u); c.stroke()
|
| 272 |
}
|
| 273 |
-
const
|
| 274 |
-
|
| 275 |
-
text(c, '人', X - off - size * 0.1, ly, 64 * u, F.kai, COL.gold, la)
|
| 276 |
-
text(c, '+', X, ly, 40 * u, F.song, COL.muted, la)
|
| 277 |
-
text(c, '为', X + off + size * 0.06, ly, 64 * u, F.kai, COL.paper, la)
|
| 278 |
-
text(c, '伪 = 人为 · 后天的努力与塑造', X, ly + 96 * u, 34 * u, F.song, COL.paper, ramp(lt, kh, 0.8), 'center', 6 * u)
|
| 279 |
},
|
| 280 |
},
|
| 281 |
|
|
@@ -643,10 +651,13 @@ export const partA: Record<string, Scene> = {
|
|
| 643 |
const { c, W, H, u, P, lt } = S
|
| 644 |
const X = W / 2, Y = P ? H * 0.45 : H * 0.47, R = Math.min(W, H) * 0.29
|
| 645 |
const kn = S.k('c3l10', '绳墨'), kb = S.k('c3l10', '博学'), kc = S.k('c3l10', '参省'), kz = S.k('c3l10', '知与行')
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
|
|
|
|
|
|
|
|
|
| 650 |
const oa = ramp(lt, kb - 0.3, 0.8)
|
| 651 |
c.setLineDash([3 * u, 9 * u]); ellipse(c, X, Y, R, R, undefined, rgba(COL.paper, 0.6 * oa), 1.6 * u); c.setLineDash([])
|
| 652 |
for (let i = 0; i < 12; i++) {
|
|
|
|
| 1 |
// 场景(上):片头、章节卡、其人其书、思想底色、学不可以已
|
| 2 |
import type { SceneCtx } from '../render'
|
| 3 |
+
import { WEI_REN, WEI_WEI } from './weiGlyph'
|
| 4 |
import { TL } from '../timeline'
|
| 5 |
import { clamp, easeIn, easeInOut, easeOut, easeOutBack, easeOutExpo, fbm1, hash, lerp, noise1, ramp, rng, smooth, win, type Rect } from '../engine/util'
|
| 6 |
import { COL, F, bez, brush, dust, font, frame, glow, hairline, inkBlob, mountains, revealChar, rgba, seal, stamp, text, vtext, type Ctx } from '../engine/draw'
|
|
|
|
| 44 |
}
|
| 45 |
|
| 46 |
const CH_KEY = ['荀', '性', '学', '假', '积', '止']
|
| 47 |
+
let _wei: { ren: Path2D; wei: Path2D } | null = null
|
| 48 |
+
const weiPaths = () => (_wei ??= { ren: new Path2D(WEI_REN), wei: new Path2D(WEI_WEI) })
|
| 49 |
|
| 50 |
export const partA: Record<string, Scene> = {
|
| 51 |
// ---------- 片头 ----------
|
|
|
|
| 184 |
const rows = P ? 2 : 1, per = 32 / rows
|
| 185 |
const totalW = (P ? 0.9 : 0.86) * W
|
| 186 |
const sw = (totalW / per) * 0.74, gap = totalW / per
|
| 187 |
+
const sh = P ? H * 0.22 : H * 0.5
|
| 188 |
+
const top = P ? H * 0.19 : H * 0.17
|
| 189 |
const focus = ramp(lt, kq - 0.2, 0.9)
|
| 190 |
for (let j = 0; j < 32; j++) {
|
| 191 |
const row = Math.floor(j / per), col = j % per
|
|
|
|
| 217 |
c.beginPath(); c.moveTo(W / 2 - totalW / 2, y + sh * f); c.lineTo(W / 2 + totalW / 2, y + sh * f); c.stroke()
|
| 218 |
}
|
| 219 |
}
|
| 220 |
+
const by = P ? top + 2 * sh + H * 0.09 : top + sh + H * 0.1
|
| 221 |
+
text(c, '《荀子》 三十二篇', W / 2, by, 44 * u, F.kai, COL.paper, ramp(lt, k0, 0.8) * (1 - ramp(lt, kd - 1.6, 0.9)), 'center', 12 * u)
|
| 222 |
text(c, '西汉 刘向 校定 · 劝学居首', W / 2, by + 52 * u, 22 * u, F.song, COL.muted, ramp(lt, k0 + 1, 0.8) * (1 - ramp(lt, kd - 1.5, 1)), 'center', 6 * u)
|
| 223 |
const da = ramp(lt, kd - 0.3, 0.8)
|
| 224 |
if (da > 0) {
|
|
|
|
| 242 |
const s2 = bez([cxp - s * 0.04, cyp - s * 0.1], [cxp + s * 0.12, cyp + s * 0.3], [cxp + s * 0.5, cyp + s * 0.44])
|
| 243 |
brush(c, s1, s * 0.15, easeInOut(ramp(lt, 0.4, 1.0)), COL.paper, 0.95, 3, 0.7)
|
| 244 |
brush(c, s2, s * 0.17, easeInOut(ramp(lt, 1.25, 1.0)), COL.paper, 0.95, 7, 0.7)
|
|
|
|
| 245 |
text(c, '荀子如何看“人”?', cxp, cyp + s * 0.72, 30 * u, F.song, COL.gold, ramp(lt, 2.2, 1) * (1 - shift), 'center', 8 * u)
|
| 246 |
},
|
| 247 |
},
|
|
|
|
| 249 |
wei: {
|
| 250 |
draw(S) {
|
| 251 |
const { c, W, H, u, P, lt } = S
|
| 252 |
+
const size = Math.min(W, H) * 0.46
|
| 253 |
+
const X = W / 2, Y = H * 0.42
|
| 254 |
const kx = S.k('c2l3', '不是虚伪'), kr = S.k('c2l3', '而是'), kh = S.k('c2l3', '后天')
|
| 255 |
+
// 拆字:按“伪”字真实笔画分成“亻”和“为”两组,向两侧分开,再分别化为完整的“人”“为”
|
| 256 |
+
const sp = easeInOut(ramp(lt, kr - 0.3, 1.4))
|
| 257 |
+
const cf = smooth((sp - 0.5) / 0.5)
|
| 258 |
+
const ra = easeOut(clamp(lt / 0.9))
|
| 259 |
+
const dRen = -0.3 * size * sp, dWei = 0.38 * size * sp
|
| 260 |
+
inkBlob(c, X + dRen * 0.6, Y, size * (0.8 - 0.25 * sp), 51, '#3a342b', 0.5, 0.3, lt)
|
| 261 |
+
if (sp > 0) inkBlob(c, X + dWei * 1.2, Y, size * 0.55 * sp, 52, '#3a342b', 0.45 * sp, 0.3, lt)
|
| 262 |
+
const part = (path: Path2D, dx: number, color: string, a: number) => {
|
| 263 |
+
if (a <= 0) return
|
| 264 |
+
c.save()
|
| 265 |
+
c.translate(X + dx, Y)
|
| 266 |
+
const k = size * (1 + 0.1 * (1 - ra))
|
| 267 |
+
c.scale(k, k); c.translate(-0.5, 0.353)
|
| 268 |
+
c.fillStyle = rgba(color, a); c.fill(path)
|
| 269 |
+
c.restore()
|
| 270 |
+
}
|
| 271 |
+
part(weiPaths().ren, dRen, sp > 0.05 ? mix(COL.paper, COL.gold, sp) : COL.paper, ra * (1 - cf))
|
| 272 |
+
part(weiPaths().wei, dWei, COL.paper, ra * (1 - cf))
|
| 273 |
+
const fs = size * 0.8
|
| 274 |
+
revealChar(c, '人', X - 0.57 * size, Y, fs, F.brush, COL.gold, cf)
|
| 275 |
+
revealChar(c, '为', X + 0.53 * size, Y, fs, F.brush, COL.paper, cf)
|
| 276 |
+
text(c, '+', X - 0.02 * size, Y, 56 * u, F.song, COL.muted, cf)
|
| 277 |
// 虚伪 ✗
|
| 278 |
const xa = win(lt, kx - 0.1, kr + 0.4, 0.4)
|
| 279 |
if (xa > 0) {
|
| 280 |
+
const qx = P ? X : X + size * 1.3, qy = P ? Y + size * 0.78 : Y
|
| 281 |
text(c, '虚伪', qx, qy, 48 * u, F.kai, COL.muted, xa, 'center', 6 * u)
|
| 282 |
c.strokeStyle = rgba(COL.red, xa); c.lineWidth = 4 * u
|
| 283 |
c.beginPath(); c.moveTo(qx - 60 * u, qy + 4 * u); c.lineTo(qx - 60 * u + 120 * u * ramp(lt, kx + 0.5, 0.4), qy - 4 * u); c.stroke()
|
| 284 |
}
|
| 285 |
+
const ly = Y + size * 0.78
|
| 286 |
+
text(c, '伪 = 人为 · 后天的努力与塑造', X, ly, 36 * u, F.song, COL.paper, ramp(lt, kh, 0.8), 'center', 6 * u)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 287 |
},
|
| 288 |
},
|
| 289 |
|
|
|
|
| 651 |
const { c, W, H, u, P, lt } = S
|
| 652 |
const X = W / 2, Y = P ? H * 0.45 : H * 0.47, R = Math.min(W, H) * 0.29
|
| 653 |
const kn = S.k('c3l10', '绳墨'), kb = S.k('c3l10', '博学'), kc = S.k('c3l10', '参省'), kz = S.k('c3l10', '知与行')
|
| 654 |
+
// 两侧:绳墨 / 砺石 —— 外在的规范(放在圆环两侧,避开上下的“博学”“参省”标注)
|
| 655 |
+
const sa = ramp(lt, kn - 0.2, 0.7) * (1 - 0.45 * ramp(lt, kb, 0.8))
|
| 656 |
+
const lx = P ? W * 0.11 : W * 0.2, rx = P ? W * 0.89 : W * 0.8
|
| 657 |
+
vtext(c, '绳墨', lx, Y - 40 * u, 48 * u, F.kai, COL.paper, sa)
|
| 658 |
+
vtext(c, '砺石', rx, Y - 40 * u, 48 * u, F.kai, COL.paper, sa)
|
| 659 |
+
vtext(c, '外在的规范', lx + (P ? 0 : -58 * u), P ? Y + 90 * u : Y - 40 * u, 22 * u, F.song, COL.muted, sa, 1.3)
|
| 660 |
+
vtext(c, '外在的规范', rx + (P ? 0 : 58 * u), P ? Y + 90 * u : Y - 40 * u, 22 * u, F.song, COL.muted, sa, 1.3)
|
| 661 |
const oa = ramp(lt, kb - 0.3, 0.8)
|
| 662 |
c.setLineDash([3 * u, 9 * u]); ellipse(c, X, Y, R, R, undefined, rgba(COL.paper, 0.6 * oa), 1.6 * u); c.setLineDash([])
|
| 663 |
for (let i = 0; i < 12; i++) {
|
quanxue-src/src/quanxue/scenes/partB.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { carveStrikes, getLine } from '../timeline'
|
|
| 4 |
import { clamp, easeInOut, easeOut, easeOutExpo, fbm1, hash, lerp, noise1, ramp, rng, smooth, win, type Rect } from '../engine/util'
|
| 5 |
import { COL, F, brush, cached, dust, font, glow, hairline, inkBlob, makeCanvas, mountains, revealChar, rgba, scholar, seal, stamp, text, vtext, type Ctx } from '../engine/draw'
|
| 6 |
import { arrow, caption, ellipse, mn, two, type Scene } from './partA'
|
|
|
|
| 7 |
|
| 8 |
/** 山形剪影 */
|
| 9 |
function hill(c: Ctx, x: number, base: number, w: number, h: number, seed: number, color: string, a: number) {
|
|
@@ -12,7 +13,9 @@ function hill(c: Ctx, x: number, base: number, w: number, h: number, seed: numbe
|
|
| 12 |
for (let i = 0; i <= 60; i++) {
|
| 13 |
const q = i / 60, px = x - w / 2 + q * w
|
| 14 |
const env = Math.pow(Math.sin(q * Math.PI), 1.4)
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
c.closePath()
|
| 18 |
const g = c.createLinearGradient(0, base - h, 0, base)
|
|
@@ -54,32 +57,152 @@ function panelMountain(S: SceneCtx, r: Rect, p: number, rain: number) {
|
|
| 54 |
}
|
| 55 |
function panelAbyss(S: SceneCtx, r: Rect, p: number, dragon: number) {
|
| 56 |
const { c, u, lt } = S
|
| 57 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
const g = c.createLinearGradient(0, top, 0, bot)
|
| 59 |
-
g.addColorStop(0, rgba('#
|
| 60 |
-
c.fillStyle = g
|
| 61 |
-
c.
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
if (p < 1) for (let i = 0; i < 4; i++) {
|
| 66 |
const ph = (lt * 0.7 + i / 4) % 1
|
| 67 |
const x = r.x + r.w * (0.35 + i * 0.1), y = lerp(r.y + r.h * 0.05, top, ph * ph)
|
| 68 |
ellipse(c, x, y, 3 * u, 6 * u, rgba('#cfe4ef', 0.8))
|
| 69 |
if (ph > 0.9) ellipse(c, x, top, (ph - 0.9) * 300 * u, (ph - 0.9) * 60 * u, undefined, rgba('#cfe4ef', 0.5), u)
|
| 70 |
}
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
const pts: [number, number][] = []
|
| 73 |
-
for (let
|
| 74 |
-
const q =
|
| 75 |
-
const x =
|
| 76 |
-
pts.push([x,
|
| 77 |
}
|
| 78 |
-
|
| 79 |
-
const hd = pts[Math.min(60, Math.floor(60 * easeInOut(dragon)))]
|
| 80 |
-
glow(c, hd[0], hd[1], 26 * u, '#ffe1a0', 0.8 * dragon)
|
| 81 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
}
|
|
|
|
| 83 |
function panelHeart(S: SceneCtx, r: Rect, p: number) {
|
| 84 |
const { c, u, lt } = S
|
| 85 |
const x = r.x + r.w / 2, y = r.y + r.h * 0.45, R = mn(r) * 0.32
|
|
@@ -116,7 +239,7 @@ export const partB: Record<string, Scene> = {
|
|
| 116 |
hill(c, mx, gy, r.w * 0.5, mh, 12, '#9a8f7a', 0.95)
|
| 117 |
const sa = ramp(lt, kd - 0.2, 0.7)
|
| 118 |
cone(c, mx, gy - mh - mn(r) * 0.12, Math.PI * 0.05, 0.9 * reveal, r.w * 0.75, sa)
|
| 119 |
-
scholar(c, mx, gy - mh +
|
| 120 |
text(c, '登高博见', mx, gy + 40 * u, 26 * u, F.kai, COL.gold, sa)
|
| 121 |
const la = ramp(lt, ks - 0.2, 0.6), lb = ramp(lt, kx - 0.2, 0.6)
|
| 122 |
text(c, '终日而思', r.x + r.w * 0.25, r.y + r.h * 0.08, 34 * u, F.kai, COL.muted, la)
|
|
@@ -135,7 +258,7 @@ export const partB: Record<string, Scene> = {
|
|
| 135 |
const aa = ramp(lt, ka - 0.4, 0.6)
|
| 136 |
const gy = A.y + A.h * 0.8
|
| 137 |
hill(c, A.x + A.w * 0.28, gy, A.w * 0.5, A.h * 0.4, 7, '#8d8370', aa)
|
| 138 |
-
const px = A.x + A.w * 0.28, py = gy - A.h * 0.4 +
|
| 139 |
scholar(c, px, py, mn(A) * 0.2, COL.paper, aa, 'wave', lt)
|
| 140 |
for (let i = 0; i < 4; i++) {
|
| 141 |
const p = ((lt - ka) * 0.5 + i / 4) % 1
|
|
@@ -299,45 +422,42 @@ export const partB: Record<string, Scene> = {
|
|
| 299 |
const r = S.art
|
| 300 |
const ka = S.k('c5l1', '积土成山'), kr = S.k('c5l1', '风雨兴焉'), kb = S.k('c5l1', '积水成渊'), kd = S.k('c5l1', '蛟龙生焉'), kc = S.k('c5l1', '积善成德'), ke = S.k('c5l1', '圣心备焉')
|
| 301 |
const k2 = S.ls('c5l2'), kq = S.k('c5l2', '量的积累')
|
| 302 |
-
const
|
| 303 |
const pa = ramp(lt, ka - 0.3, 3), rain = ramp(lt, kr - 0.2, 0.8)
|
| 304 |
const pb = ramp(lt, kb - 0.3, 3), dr = ramp(lt, kd - 0.2, 2.4)
|
| 305 |
const pc = ramp(lt, kc - 0.2, 2.2)
|
| 306 |
-
|
| 307 |
-
const
|
|
|
|
|
|
|
|
|
|
| 308 |
const labels = ['积土成山', '积水成渊', '积善成德']
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
if (i === 0) panelMountain(S, q, 1, 1)
|
| 330 |
-
if (i === 1) panelAbyss(S, q, 1, 1)
|
| 331 |
-
if (i === 2) panelHeart(S, q, 1)
|
| 332 |
-
text(c, ['山', '渊', '德'][i], q.x + q.w / 2, q.y + q.h + 30 * u, 40 * u, F.brush, COL.paper, 1)
|
| 333 |
}
|
| 334 |
-
const qa = ramp(lt, kq - 0.2, 0.8)
|
| 335 |
-
const yy = r.y + r.h * 0.94
|
| 336 |
-
text(c, '量变', r.x + r.w * 0.32, yy, 40 * u, F.kai, COL.muted, qa)
|
| 337 |
-
arrow(c, r.x + r.w * 0.42, yy, r.x + r.w * 0.58, yy, COL.gold, qa, 2 * u)
|
| 338 |
-
text(c, '质变', r.x + r.w * 0.68, yy, 40 * u, F.kai, COL.gold, qa)
|
| 339 |
c.globalAlpha = 1
|
| 340 |
}
|
|
|
|
|
|
|
|
|
|
| 341 |
void ke
|
| 342 |
},
|
| 343 |
},
|
|
@@ -363,25 +483,8 @@ export const partB: Record<string, Scene> = {
|
|
| 363 |
text(c, '千里', A.x + A.w * 0.5, A.y + A.h * 0.12, 34 * u, F.kai, COL.gold, ramp(lt, kq, 0.6))
|
| 364 |
caption(S, A, '跬步 · 半步', ramp(lt, ka, 0.6), COL.muted)
|
| 365 |
// 小流 → 江海
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
const g = c.createLinearGradient(0, B.y + B.h * 0.12, 0, B.y + B.h * 0.3)
|
| 369 |
-
g.addColorStop(0, rgba('#d9e7ee', 0.0)); g.addColorStop(1, rgba('#9fbcd0', 0.45 * sea))
|
| 370 |
-
c.fillStyle = g; c.fillRect(B.x, B.y + B.h * 0.12, B.w, B.h * 0.18)
|
| 371 |
-
glow(c, B.x + B.w / 2, B.y + B.h * 0.22, B.w * 0.5, '#cfe4ef', 0.3 * sea)
|
| 372 |
-
for (let i = 0; i < 5; i++) {
|
| 373 |
-
const sx = B.x + B.w * (0.08 + i * 0.21)
|
| 374 |
-
const pts: [number, number][] = []
|
| 375 |
-
for (let j = 0; j <= 40; j++) {
|
| 376 |
-
const q = j / 40
|
| 377 |
-
const x = lerp(sx, B.x + B.w / 2, Math.pow(q, 1.5)) + Math.sin(q * 8 + i) * 8 * u * (1 - q)
|
| 378 |
-
const y = lerp(B.y + B.h * 0.86, B.y + B.h * 0.3, q)
|
| 379 |
-
pts.push([x, y])
|
| 380 |
-
}
|
| 381 |
-
brush(c, pts, lerp(4, 10, i === 2 ? 1 : 0.5) * u, sp, '#8fb3cc', 0.8, 20 + i, 0.3)
|
| 382 |
-
}
|
| 383 |
-
text(c, '江海', B.x + B.w / 2, B.y + B.h * 0.07, 34 * u, F.kai, COL.gold, sea)
|
| 384 |
-
caption(S, B, '小流 · 细水', ramp(lt, kb, 0.6), COL.muted)
|
| 385 |
},
|
| 386 |
},
|
| 387 |
|
|
|
|
| 4 |
import { clamp, easeInOut, easeOut, easeOutExpo, fbm1, hash, lerp, noise1, ramp, rng, smooth, win, type Rect } from '../engine/util'
|
| 5 |
import { COL, F, brush, cached, dust, font, glow, hairline, inkBlob, makeCanvas, mountains, revealChar, rgba, scholar, seal, stamp, text, vtext, type Ctx } from '../engine/draw'
|
| 6 |
import { arrow, caption, ellipse, mn, two, type Scene } from './partA'
|
| 7 |
+
import { drawDragon } from './dragon'
|
| 8 |
|
| 9 |
/** 山形剪影 */
|
| 10 |
function hill(c: Ctx, x: number, base: number, w: number, h: number, seed: number, color: string, a: number) {
|
|
|
|
| 13 |
for (let i = 0; i <= 60; i++) {
|
| 14 |
const q = i / 60, px = x - w / 2 + q * w
|
| 15 |
const env = Math.pow(Math.sin(q * Math.PI), 1.4)
|
| 16 |
+
// 起伏噪声在正中为 0:峰顶恰好位于中心、高度恰为 h(人物站在峰顶时脚底贴合山体)
|
| 17 |
+
const rough = 0.16 * (0.5 + 0.5 * fbm1(q * 5 + seed, 4)) * Math.min(1, Math.abs(q - 0.5) * 6)
|
| 18 |
+
c.lineTo(px, base - h * env * (1 - rough))
|
| 19 |
}
|
| 20 |
c.closePath()
|
| 21 |
const g = c.createLinearGradient(0, base - h, 0, base)
|
|
|
|
| 57 |
}
|
| 58 |
function panelAbyss(S: SceneCtx, r: Rect, p: number, dragon: number) {
|
| 59 |
const { c, u, lt } = S
|
| 60 |
+
const k = mn(r) / 600
|
| 61 |
+
const top = r.y + r.h * (0.6 - 0.34 * easeOut(p)), bot = r.y + r.h * 0.88
|
| 62 |
+
const xl = r.x + r.w * 0.07, xr = r.x + r.w * 0.93
|
| 63 |
+
// 深潭水体
|
| 64 |
+
c.save()
|
| 65 |
+
c.beginPath(); c.moveTo(xl, top)
|
| 66 |
+
for (let i = 0; i <= 40; i++) c.lineTo(lerp(xl, xr, i / 40), top + Math.sin(i * 0.6 + lt * 2) * 3 * u)
|
| 67 |
+
c.lineTo(xr, bot); c.quadraticCurveTo(r.x + r.w / 2, bot + r.h * 0.1, xl, bot); c.closePath()
|
| 68 |
const g = c.createLinearGradient(0, top, 0, bot)
|
| 69 |
+
g.addColorStop(0, rgba('#4a6c86', 0.85)); g.addColorStop(0.35, rgba('#1f3a52', 0.95)); g.addColorStop(1, rgba('#060d16', 1))
|
| 70 |
+
c.fillStyle = g; c.fill()
|
| 71 |
+
c.clip()
|
| 72 |
+
// 潭心漩涡与水下光
|
| 73 |
+
const vx = r.x + r.w * 0.5, vy = lerp(top, bot, 0.62)
|
| 74 |
+
glow(c, vx, lerp(top, bot, 0.15), r.w * 0.45, '#7fb0cf', 0.18 * p)
|
| 75 |
+
c.lineWidth = 1.2 * u
|
| 76 |
+
for (let i = 0; i < 7; i++) {
|
| 77 |
+
const rr = (40 + i * 34) * k, a0 = lt * (0.5 - i * 0.04) + i * 1.3
|
| 78 |
+
c.strokeStyle = rgba('#a8cbe0', 0.16 * p * (1 - i / 8))
|
| 79 |
+
c.beginPath(); c.ellipse(vx, vy, rr * 1.6, rr * 0.45, 0, a0, a0 + Math.PI * 1.1); c.stroke()
|
| 80 |
+
}
|
| 81 |
+
// 上升的气泡
|
| 82 |
+
for (let i = 0; i < 18; i++) {
|
| 83 |
+
const ph = (lt * (0.12 + hash(i) * 0.1) + hash(i + 7)) % 1
|
| 84 |
+
const x = lerp(xl, xr, hash(i + 3)) + Math.sin(lt * 2 + i) * 6 * u, y = lerp(bot, top, ph)
|
| 85 |
+
ellipse(c, x, y, (1.5 + hash(i + 1) * 2.5) * u, (1.5 + hash(i + 1) * 2.5) * u, undefined, rgba('#cfe4ef', 0.35 * (1 - ph) * p), u)
|
| 86 |
+
}
|
| 87 |
+
// 蛟龙:自深处升起
|
| 88 |
+
if (dragon > 0) {
|
| 89 |
+
const L = (xr - xl) * 0.7, W0 = L * 0.062
|
| 90 |
+
const hx = r.x + r.w * (0.74 + 0.03 * Math.sin(lt * 0.35)), hy = lerp(top, bot, 0.42) + (1 - easeOut(dragon)) * (bot - top) * 0.5
|
| 91 |
+
glow(c, hx, hy, W0 * 5, '#ffd88a', 0.35 * dragon)
|
| 92 |
+
drawDragon(c, hx, hy, L, W0, lt, clamp(dragon * 1.4))
|
| 93 |
+
}
|
| 94 |
+
c.restore()
|
| 95 |
+
// 两侧崖壁
|
| 96 |
+
for (const side of [-1, 1]) {
|
| 97 |
+
c.beginPath()
|
| 98 |
+
const x0 = side < 0 ? r.x : r.x + r.w
|
| 99 |
+
c.moveTo(x0, r.y + r.h * 0.12)
|
| 100 |
+
for (let i = 0; i <= 30; i++) {
|
| 101 |
+
const q = i / 30, y = lerp(r.y + r.h * 0.12, r.y + r.h, q)
|
| 102 |
+
const wv = r.w * (0.1 + 0.05 * fbm1(q * 4 + (side > 0 ? 9 : 2), 4) + 0.04 * q)
|
| 103 |
+
c.lineTo(x0 - side * wv, y)
|
| 104 |
+
}
|
| 105 |
+
c.lineTo(x0, r.y + r.h); c.closePath()
|
| 106 |
+
const cg = c.createLinearGradient(x0, 0, x0 - side * r.w * 0.18, 0)
|
| 107 |
+
cg.addColorStop(0, 'rgba(18,16,13,0.95)'); cg.addColorStop(1, 'rgba(48,43,36,0.9)')
|
| 108 |
+
c.fillStyle = cg; c.fill()
|
| 109 |
+
}
|
| 110 |
+
// 水滴落入潭中
|
| 111 |
if (p < 1) for (let i = 0; i < 4; i++) {
|
| 112 |
const ph = (lt * 0.7 + i / 4) % 1
|
| 113 |
const x = r.x + r.w * (0.35 + i * 0.1), y = lerp(r.y + r.h * 0.05, top, ph * ph)
|
| 114 |
ellipse(c, x, y, 3 * u, 6 * u, rgba('#cfe4ef', 0.8))
|
| 115 |
if (ph > 0.9) ellipse(c, x, top, (ph - 0.9) * 300 * u, (ph - 0.9) * 60 * u, undefined, rgba('#cfe4ef', 0.5), u)
|
| 116 |
}
|
| 117 |
+
}
|
| 118 |
+
/** 百川汇流入海:群山细流 → 逐级汇合 → 大江 → 海水纹 */
|
| 119 |
+
function panelRiverSea(S: SceneCtx, r: Rect, sp: number, sea: number) {
|
| 120 |
+
const { c, u, lt } = S
|
| 121 |
+
const X = (f: number) => r.x + r.w * f, Y = (f: number) => r.y + r.h * f
|
| 122 |
+
// 远山
|
| 123 |
+
hill(c, X(0.3), Y(0.2), r.w * 0.7, r.h * 0.12, 71, '#6a6357', 0.9)
|
| 124 |
+
hill(c, X(0.72), Y(0.2), r.w * 0.6, r.h * 0.09, 72, '#57524a', 0.9)
|
| 125 |
+
// 河网:8 条细流 → 4 → 2 → 1
|
| 126 |
+
const L0 = [0.08, 0.2, 0.32, 0.44, 0.56, 0.68, 0.8, 0.92], L1 = [0.15, 0.38, 0.62, 0.85], L2 = [0.27, 0.73]
|
| 127 |
+
type Seg = { a: [number, number]; b: [number, number]; w: number; t0: number; t1: number; seed: number }
|
| 128 |
+
const segs: Seg[] = []
|
| 129 |
+
L0.forEach((x, i) => segs.push({ a: [x, 0.17], b: [L1[i >> 1], 0.31], w: 1.5, t0: 0.0 + i * 0.02, t1: 0.3 + i * 0.02, seed: i }))
|
| 130 |
+
L1.forEach((x, i) => segs.push({ a: [x, 0.31], b: [L2[i >> 1], 0.44], w: 2.8, t0: 0.32, t1: 0.52, seed: 10 + i }))
|
| 131 |
+
L2.forEach((x, i) => segs.push({ a: [x, 0.44], b: [0.5, 0.55], w: 4.6, t0: 0.52, t1: 0.7, seed: 20 + i }))
|
| 132 |
+
const curve = (sg: Seg, n = 24) => {
|
| 133 |
const pts: [number, number][] = []
|
| 134 |
+
for (let k = 0; k <= n; k++) {
|
| 135 |
+
const q = k / n
|
| 136 |
+
const x = lerp(sg.a[0], sg.b[0], smooth(q)) + Math.sin(q * Math.PI * 2 + sg.seed) * 0.025 * Math.sin(q * Math.PI)
|
| 137 |
+
pts.push([X(x), Y(lerp(sg.a[1], sg.b[1], q))])
|
| 138 |
}
|
| 139 |
+
return pts
|
|
|
|
|
|
|
| 140 |
}
|
| 141 |
+
c.lineCap = 'round'; c.lineJoin = 'round'
|
| 142 |
+
for (const sg of segs) {
|
| 143 |
+
const pr = clamp((sp - sg.t0) / (sg.t1 - sg.t0))
|
| 144 |
+
if (pr <= 0) continue
|
| 145 |
+
const pts = curve(sg), m = Math.max(1, Math.round(pts.length * pr))
|
| 146 |
+
for (const [lw, col, al] of [[sg.w * 4, '#7fb0cf', 0.12], [sg.w, '#a9cde2', 0.95]] as const) {
|
| 147 |
+
c.strokeStyle = rgba(col, al); c.lineWidth = lw * u
|
| 148 |
+
c.beginPath(); for (let k = 0; k < m; k++) k ? c.lineTo(pts[k][0], pts[k][1]) : c.moveTo(pts[k][0], pts[k][1]); c.stroke()
|
| 149 |
+
}
|
| 150 |
+
if (pr >= 1) for (let d = 0; d < 3; d++) { // 流动的光点
|
| 151 |
+
const q = (lt * 0.5 + d / 3 + sg.seed * 0.13) % 1, k = Math.floor(q * (pts.length - 1))
|
| 152 |
+
ellipse(c, pts[k][0], pts[k][1], sg.w * 0.9 * u, sg.w * 0.9 * u, rgba('#eaf6ff', 0.8))
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
// 大江:自汇流点向下渐宽,喇叭口入海
|
| 156 |
+
const tp = clamp((sp - 0.7) / 0.3)
|
| 157 |
+
if (tp > 0) {
|
| 158 |
+
const y0 = 0.55, y1 = lerp(0.55, 0.66, tp)
|
| 159 |
+
c.beginPath()
|
| 160 |
+
const N = 20
|
| 161 |
+
const half = (q: number) => r.w * lerp(0.012, 0.09, Math.pow(q, 2.2))
|
| 162 |
+
const cxq = (q: number) => X(0.5 + 0.03 * Math.sin(q * 4))
|
| 163 |
+
for (let k = 0; k <= N; k++) { const q = k / N, y = Y(lerp(y0, y1, q)); k ? c.lineTo(cxq(q) - half(q * tp), y) : c.moveTo(cxq(q) - half(q * tp), y) }
|
| 164 |
+
for (let k = N; k >= 0; k--) { const q = k / N; c.lineTo(cxq(q) + half(q * tp), Y(lerp(y0, y1, q))) }
|
| 165 |
+
c.closePath()
|
| 166 |
+
const rg = c.createLinearGradient(0, Y(y0), 0, Y(y1))
|
| 167 |
+
rg.addColorStop(0, rgba('#a9cde2', 0.95)); rg.addColorStop(1, rgba('#4f7f9e', 0.95))
|
| 168 |
+
c.fillStyle = rg; c.fill()
|
| 169 |
+
for (let d = 0; d < 6; d++) { const q = (lt * 0.35 + d / 6) % 1; const y = Y(lerp(y0, y1, q)); c.strokeStyle = rgba('#eaf6ff', 0.5 * (1 - q)); c.lineWidth = 1.2 * u; c.beginPath(); c.moveTo(cxq(q) - half(q * tp) * 0.6, y); c.lineTo(cxq(q) + half(q * tp) * 0.6, y); c.stroke() }
|
| 170 |
+
}
|
| 171 |
+
// 海:海水纹(层叠的同心弧)
|
| 172 |
+
if (sea > 0) {
|
| 173 |
+
const st = Y(0.645), sb = r.y + r.h
|
| 174 |
+
c.save()
|
| 175 |
+
c.beginPath(); c.rect(r.x, st, r.w, (sb - st) * easeOut(sea)); c.clip()
|
| 176 |
+
const bg = c.createLinearGradient(0, st, 0, sb)
|
| 177 |
+
bg.addColorStop(0, '#2a5370'); bg.addColorStop(1, '#0a1824')
|
| 178 |
+
c.fillStyle = bg; c.fillRect(r.x, st, r.w, sb - st)
|
| 179 |
+
const R = r.w / 8.5
|
| 180 |
+
let row = 0
|
| 181 |
+
for (let y = st + R * 0.15; y < sb + R; y += R * 0.42, row++) {
|
| 182 |
+
const drift = Math.sin(lt * 0.6 + row * 0.9) * R * 0.18 + (row % 2 ? R : 0)
|
| 183 |
+
const depth = clamp((y - st) / (sb - st))
|
| 184 |
+
for (let x = r.x - 2 * R + drift; x < r.x + r.w + 2 * R; x += 2 * R) {
|
| 185 |
+
c.beginPath(); c.arc(x, y + R, R, Math.PI, 0); c.closePath()
|
| 186 |
+
c.fillStyle = mixHex('#2f5d7c', '#0d2131', depth); c.fill()
|
| 187 |
+
for (const [k, al] of [[1, 0.75], [0.74, 0.5], [0.48, 0.35], [0.22, 0.25]] as const) {
|
| 188 |
+
c.strokeStyle = rgba('#c9e0ee', al * (1 - 0.6 * depth)); c.lineWidth = Math.max(1, 1.3 * u)
|
| 189 |
+
c.beginPath(); c.arc(x, y + R, R * k, Math.PI, 0); c.stroke()
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
}
|
| 193 |
+
// 入海口的浪花与海面天光
|
| 194 |
+
glow(c, X(0.5), st, r.w * 0.5, '#d9eef8', 0.35 * sea)
|
| 195 |
+
for (let i = 0; i < 14; i++) { const ph = (lt * 0.4 + hash(i)) % 1; ellipse(c, X(0.5) + (hash(i + 3) - 0.5) * r.w * 0.3 * (0.5 + ph), st + ph * 18 * u, 2 * u, 1.2 * u, rgba('#ffffff', 0.7 * (1 - ph) * sea)) }
|
| 196 |
+
c.restore()
|
| 197 |
+
text(c, '江海', X(0.5), Y(0.82), 46 * u, F.brush, COL.gold, sea, 'center', 10 * u)
|
| 198 |
+
}
|
| 199 |
+
}
|
| 200 |
+
function mixHex(a: string, b: string, t: number) {
|
| 201 |
+
const pa = parseInt(a.slice(1), 16), pb = parseInt(b.slice(1), 16)
|
| 202 |
+
const ch = (s: number) => Math.round(lerp((pa >> s) & 255, (pb >> s) & 255, clamp(t)))
|
| 203 |
+
return `rgb(${ch(16)},${ch(8)},${ch(0)})`
|
| 204 |
}
|
| 205 |
+
|
| 206 |
function panelHeart(S: SceneCtx, r: Rect, p: number) {
|
| 207 |
const { c, u, lt } = S
|
| 208 |
const x = r.x + r.w / 2, y = r.y + r.h * 0.45, R = mn(r) * 0.32
|
|
|
|
| 239 |
hill(c, mx, gy, r.w * 0.5, mh, 12, '#9a8f7a', 0.95)
|
| 240 |
const sa = ramp(lt, kd - 0.2, 0.7)
|
| 241 |
cone(c, mx, gy - mh - mn(r) * 0.12, Math.PI * 0.05, 0.9 * reveal, r.w * 0.75, sa)
|
| 242 |
+
scholar(c, mx, gy - mh + 3 * u, mn(r) * 0.14, COL.paper, sa)
|
| 243 |
text(c, '登高博见', mx, gy + 40 * u, 26 * u, F.kai, COL.gold, sa)
|
| 244 |
const la = ramp(lt, ks - 0.2, 0.6), lb = ramp(lt, kx - 0.2, 0.6)
|
| 245 |
text(c, '终日而思', r.x + r.w * 0.25, r.y + r.h * 0.08, 34 * u, F.kai, COL.muted, la)
|
|
|
|
| 258 |
const aa = ramp(lt, ka - 0.4, 0.6)
|
| 259 |
const gy = A.y + A.h * 0.8
|
| 260 |
hill(c, A.x + A.w * 0.28, gy, A.w * 0.5, A.h * 0.4, 7, '#8d8370', aa)
|
| 261 |
+
const px = A.x + A.w * 0.28, py = gy - A.h * 0.4 + 3 * u
|
| 262 |
scholar(c, px, py, mn(A) * 0.2, COL.paper, aa, 'wave', lt)
|
| 263 |
for (let i = 0; i < 4; i++) {
|
| 264 |
const p = ((lt - ka) * 0.5 + i / 4) % 1
|
|
|
|
| 422 |
const r = S.art
|
| 423 |
const ka = S.k('c5l1', '积土成山'), kr = S.k('c5l1', '风雨兴焉'), kb = S.k('c5l1', '积水成渊'), kd = S.k('c5l1', '蛟龙生焉'), kc = S.k('c5l1', '积善成德'), ke = S.k('c5l1', '圣心备焉')
|
| 424 |
const k2 = S.ls('c5l2'), kq = S.k('c5l2', '量的积累')
|
| 425 |
+
const ks = S.k('c5l2', '水积成渊')
|
| 426 |
const pa = ramp(lt, ka - 0.3, 3), rain = ramp(lt, kr - 0.2, 0.8)
|
| 427 |
const pb = ramp(lt, kb - 0.3, 3), dr = ramp(lt, kd - 0.2, 2.4)
|
| 428 |
const pc = ramp(lt, kc - 0.2, 2.2)
|
| 429 |
+
// 镜头编排:引文阶段 山→渊→德;解说阶段 山→渊(放大蛟龙)→ 三联总结
|
| 430 |
+
const plan: [number, number][] = [[-9, 0], [kb - 0.6, 1], [kc - 0.6, 2], [k2 - 0.5, 0], [ks - 0.5, 1], [kq - 0.6, 3]]
|
| 431 |
+
let cur = 0
|
| 432 |
+
for (let i = 0; i < plan.length; i++) if (lt >= plan[i][0]) cur = i
|
| 433 |
+
const fadeIn = ramp(lt, plan[cur][0], 0.6)
|
| 434 |
const labels = ['积土成山', '积水成渊', '积善成德']
|
| 435 |
+
const drawPanel = (id: number, a: number, ca = a) => {
|
| 436 |
+
if (a <= 0) return
|
| 437 |
+
c.globalAlpha = a
|
| 438 |
+
if (id === 0) { panelMountain(S, r, lt > k2 - 0.6 ? 1 : pa, lt > k2 - 0.6 ? 1 : rain); c.globalAlpha = 1; caption(S, r, labels[0], ca) }
|
| 439 |
+
if (id === 1) { panelAbyss(S, r, lt > k2 - 0.6 ? 1 : pb, lt > k2 - 0.6 ? Math.max(dr, ramp(lt, ks, 1.6)) : dr); c.globalAlpha = 1; caption(S, r, labels[1], ca) }
|
| 440 |
+
if (id === 2) { panelHeart(S, r, pc); c.globalAlpha = 1; caption(S, r, labels[2], ca) }
|
| 441 |
+
if (id === 3) {
|
| 442 |
+
const P = S.P, w = r.w / 3
|
| 443 |
+
for (let i = 0; i < 3; i++) {
|
| 444 |
+
const q: Rect = P ? { x: r.x + i * w, y: r.y + r.h * 0.1, w, h: r.h * 0.7 } : { x: r.x + i * w, y: r.y + r.h * 0.12, w, h: r.h * 0.62 }
|
| 445 |
+
if (i === 0) panelMountain(S, q, 1, 1)
|
| 446 |
+
if (i === 1) panelAbyss(S, q, 1, 1)
|
| 447 |
+
if (i === 2) panelHeart(S, q, 1)
|
| 448 |
+
text(c, ['山', '渊', '德'][i], q.x + q.w / 2, q.y + q.h + 30 * u, 40 * u, F.brush, COL.paper, 1)
|
| 449 |
+
}
|
| 450 |
+
const qa = ramp(lt, kq - 0.2, 0.8)
|
| 451 |
+
const yy = r.y + r.h * 0.94
|
| 452 |
+
text(c, '量变', r.x + r.w * 0.32, yy, 40 * u, F.kai, COL.muted, qa)
|
| 453 |
+
arrow(c, r.x + r.w * 0.42, yy, r.x + r.w * 0.58, yy, COL.gold, qa, 2 * u)
|
| 454 |
+
text(c, '质变', r.x + r.w * 0.68, yy, 40 * u, F.kai, COL.gold, qa)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 456 |
c.globalAlpha = 1
|
| 457 |
}
|
| 458 |
+
// 标注先出后入,避免交叉淡化时两行字叠在一起
|
| 459 |
+
if (cur > 0 && fadeIn < 1) drawPanel(plan[cur - 1][1], 1 - fadeIn, smooth(1 - fadeIn * 2))
|
| 460 |
+
drawPanel(plan[cur][1], cur === 0 ? 1 : fadeIn, cur === 0 ? 1 : smooth(fadeIn * 2 - 1))
|
| 461 |
void ke
|
| 462 |
},
|
| 463 |
},
|
|
|
|
| 483 |
text(c, '千里', A.x + A.w * 0.5, A.y + A.h * 0.12, 34 * u, F.kai, COL.gold, ramp(lt, kq, 0.6))
|
| 484 |
caption(S, A, '跬步 · 半步', ramp(lt, ka, 0.6), COL.muted)
|
| 485 |
// 小流 → 江海
|
| 486 |
+
panelRiverSea(S, B, ramp(lt, kb - 0.2, Math.max(1.6, ke - kb + 0.4)), ramp(lt, Math.min(ke - 0.5, kb + 1.2), 1.4))
|
| 487 |
+
text(c, '小流', B.x + B.w * 0.5, B.y + B.h * 0.03, 26 * u, F.kai, COL.muted, ramp(lt, kb, 0.6), 'center', 6 * u)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
},
|
| 489 |
},
|
| 490 |
|
quanxue-src/src/quanxue/scenes/weiGlyph.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// 马善政毛笔楷书“伪”字轮廓(SIL OFL),按笔画分为“亻”与“为”两组,坐标:em=1,基线 y=0,y 向下为正
|
| 2 |
+
export const WEI_REN = "M0.284 -0.445Q0.298 -0.457 0.306 -0.4535Q0.314 -0.45 0.328 -0.43Q0.335 -0.419 0.3365 -0.4115Q0.338 -0.404 0.336 -0.384Q0.333 -0.355 0.3315 -0.33Q0.33 -0.305 0.3265 -0.276Q0.323 -0.247 0.322 -0.2085Q0.321 -0.17 0.317 -0.157Q0.314 -0.14 0.314 -0.112Q0.314 -0.084 0.319 -0.072Q0.327 -0.053 0.3245 -0.0315Q0.322 -0.01 0.312 0.003Q0.297 0.024 0.275 0.0295Q0.253 0.035 0.241 0.024Q0.231 0.018 0.2255 -0.002Q0.22 -0.022 0.221 -0.038Q0.221 -0.052 0.2175 -0.07Q0.214 -0.088 0.221 -0.1Q0.23 -0.116 0.2435 -0.2065Q0.257 -0.297 0.257 -0.35Q0.257 -0.42 0.284 -0.445ZM0.333 -0.752 0.35 -0.765 0.366 -0.75Q0.382 -0.735 0.386 -0.735Q0.392 -0.735 0.4055 -0.722Q0.419 -0.709 0.422 -0.701Q0.429 -0.658 0.406 -0.637L0.385 -0.617Q0.376 -0.609 0.3605 -0.5895Q0.345 -0.57 0.3195 -0.542Q0.294 -0.514 0.269 -0.483Q0.239 -0.444 0.212 -0.423Q0.195 -0.408 0.179 -0.394Q0.156 -0.372 0.102 -0.332Q0.085 -0.318 0.061 -0.308Q0.037 -0.298 0.034 -0.304Q0.033 -0.306 0.078 -0.364Q0.215 -0.543 0.215 -0.546Q0.215 -0.548 0.235 -0.577Q0.259 -0.611 0.308 -0.717Q0.317 -0.738 0.333 -0.752Z"
|
| 3 |
+
export const WEI_WEI = "M0.597 -0.275Q0.597 -0.281 0.61 -0.2945Q0.623 -0.308 0.645 -0.308Q0.668 -0.308 0.719 -0.297Q0.728 -0.295 0.728 -0.29Q0.728 -0.285 0.737 -0.276Q0.762 -0.251 0.741 -0.219Q0.728 -0.202 0.728 -0.1985Q0.728 -0.195 0.711 -0.188Q0.684 -0.176 0.663 -0.199Q0.653 -0.21 0.64 -0.223Q0.624 -0.235 0.6105 -0.252Q0.597 -0.269 0.597 -0.275ZM0.432 -0.586Q0.442 -0.599 0.45 -0.595Q0.502 -0.571 0.5165 -0.556Q0.531 -0.541 0.53 -0.512Q0.528 -0.497 0.503 -0.481Q0.478 -0.465 0.461 -0.47Q0.433 -0.476 0.432 -0.496Q0.429 -0.507 0.425 -0.515Q0.417 -0.531 0.419 -0.553Q0.421 -0.575 0.432 -0.586ZM0.668 -0.711Q0.674 -0.727 0.6915 -0.7465Q0.709 -0.766 0.714 -0.766Q0.72 -0.766 0.745 -0.74Q0.77 -0.714 0.776 -0.701Q0.789 -0.675 0.767 -0.652Q0.754 -0.638 0.7455 -0.6195Q0.737 -0.601 0.734 -0.594Q0.722 -0.576 0.718 -0.553Q0.71 -0.524 0.694 -0.493Q0.688 -0.481 0.6925 -0.4785Q0.697 -0.476 0.757 -0.4715Q0.817 -0.467 0.874 -0.449Q0.937 -0.428 0.954 -0.4115Q0.971 -0.395 0.962 -0.365Q0.955 -0.342 0.946 -0.322Q0.937 -0.302 0.9335 -0.265Q0.93 -0.228 0.925 -0.2185Q0.92 -0.209 0.92 -0.1945Q0.92 -0.18 0.9145 -0.1705Q0.909 -0.161 0.9055 -0.145Q0.902 -0.129 0.897 -0.113Q0.889 -0.093 0.8615 -0.053Q0.834 -0.013 0.824 -0.006Q0.813 0.001 0.792 0.015Q0.769 0.032 0.7395 0.0455Q0.71 0.059 0.699 0.059Q0.686 0.059 0.6735 0.0465Q0.661 0.034 0.661 0.02Q0.661 0.01 0.649 -0.0025Q0.637 -0.015 0.637 -0.0225Q0.637 -0.03 0.624 -0.037Q0.611 -0.045 0.5905 -0.066Q0.57 -0.087 0.571 -0.092Q0.577 -0.106 0.612 -0.083Q0.626 -0.074 0.6355 -0.072Q0.645 -0.07 0.674 -0.07Q0.711 -0.07 0.725 -0.0765Q0.739 -0.083 0.752 -0.107Q0.76 -0.126 0.764 -0.129Q0.768 -0.13 0.782 -0.173Q0.796 -0.216 0.804 -0.247Q0.824 -0.333 0.824 -0.369V-0.396L0.805 -0.404Q0.772 -0.418 0.722 -0.42Q0.682 -0.422 0.6715 -0.418Q0.661 -0.414 0.655 -0.394Q0.648 -0.372 0.638 -0.3615Q0.628 -0.351 0.621 -0.335Q0.617 -0.325 0.605 -0.305Q0.593 -0.285 0.587 -0.281Q0.585 -0.279 0.567 -0.255Q0.547 -0.231 0.523 -0.209Q0.51 -0.199 0.49 -0.1855Q0.47 -0.172 0.465 -0.172Q0.461 -0.172 0.4595 -0.168Q0.458 -0.164 0.421 -0.139Q0.361 -0.099 0.331 -0.094Q0.324 -0.094 0.324 -0.098Q0.324 -0.1 0.397 -0.1735Q0.47 -0.247 0.492 -0.278Q0.515 -0.308 0.539 -0.351Q0.563 -0.394 0.558 -0.397Q0.556 -0.402 0.5255 -0.3875Q0.495 -0.373 0.486 -0.365Q0.475 -0.355 0.458 -0.3515Q0.441 -0.348 0.43 -0.353Q0.419 -0.359 0.419 -0.379V-0.399L0.462 -0.42Q0.505 -0.439 0.508 -0.439Q0.511 -0.439 0.5495 -0.4515Q0.588 -0.464 0.593 -0.474Q0.633 -0.57 0.637 -0.596Q0.656 -0.685 0.668 -0.711Z"
|
quanxue/assets/App-CDQjHgZN.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
quanxue/assets/quanxue-b6n75eFe.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-Br42UDbl.js","./index-BlGQAcOD.js","./client-BlQxAbrl.js","./index-tKuM8enU.js","./App-CDQjHgZN.js","./jsx-dev-runtime-Czb3f8pQ.js","./App-AJceFVqW.css","./ErrorBoundary-DwultlP_.js"])))=>i.map(i=>d[i]);
|
| 2 |
+
(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))d(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const s of t.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&d(s)}).observe(document,{childList:!0,subtree:!0});function i(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function d(e){if(e.ep)return;e.ep=!0;const t=i(e);fetch(e.href,t)}})();const E="modulepreload",v=function(r,o){return new URL(r,o).href},w={},y=function(o,i,d){let e=Promise.resolve();if(i&&i.length>0){let s=function(n){return Promise.all(n.map(u=>Promise.resolve(u).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const l=document.getElementsByTagName("link"),f=document.querySelector("meta[property=csp-nonce]"),h=(f==null?void 0:f.nonce)||(f==null?void 0:f.getAttribute("nonce"));e=s(i.map(n=>{if(n=v(n,d),n in w)return;w[n]=!0;const u=n.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(!!d)for(let m=l.length-1;m>=0;m--){const g=l[m];if(g.href===n&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${p}`))return;const c=document.createElement("link");if(c.rel=u?"stylesheet":E,u||(c.as="script"),c.crossOrigin="",c.href=n,h&&c.setAttribute("nonce",h),document.head.appendChild(c),u)return new Promise((m,g)=>{c.addEventListener("load",m),c.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${n}`)))})}))}function t(s){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=s,window.dispatchEvent(l),!l.defaultPrevented)throw s}return e.then(s=>{for(const l of s||[])l.status==="rejected"&&t(l.reason);return o().catch(t)})},_="__dep_reload",L=6,O=6e4;function P(){try{return JSON.parse(sessionStorage.getItem(_)||"{}")}catch{return{c:0,t:0}}}async function R(){const r=document.getElementById("root");try{let o=function(){if(!document.querySelector("[data-surf-placeholder]"))try{window.parent.postMessage({type:"surf-app-ready"},"*")}catch{}};const i=await y(()=>import("./index-Br42UDbl.js").then(a=>a.i),__vite__mapDeps([0,1]),import.meta.url);if(typeof i.useState!="function")throw new Error("dep-stub");const{createElement:d}=i,{createRoot:e,hydrateRoot:t}=await y(async()=>{const{createRoot:a,hydrateRoot:c}=await import("./client-BlQxAbrl.js").then(m=>m.c);return{createRoot:a,hydrateRoot:c}},__vite__mapDeps([2,1]),import.meta.url),{QueryClient:s,QueryClientProvider:l}=await y(async()=>{const{QueryClient:a,QueryClientProvider:c}=await import("./index-tKuM8enU.js");return{QueryClient:a,QueryClientProvider:c}},__vite__mapDeps([3,0,1]),import.meta.url),{default:f}=await y(async()=>{const{default:a}=await import("./App-CDQjHgZN.js");return{default:a}},__vite__mapDeps([4,5,1,0,6]),import.meta.url),{default:h}=await y(async()=>{const{default:a}=await import("./ErrorBoundary-DwultlP_.js");return{default:a}},__vite__mapDeps([7,5,1,0]),import.meta.url),n=new s({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:3,retryDelay:a=>Math.min(1e3*2**a,1e4),staleTime:3e4}}}),u=d(h,null,d(l,{client:n},d(f))),p=!!r.querySelector("[data-surf-placeholder]");r.childNodes.length>0&&r.innerHTML!=="<!--ssr-outlet-->"&&!p?t(r,u):(r.innerHTML="",e(r).render(u)),window.__reactOk=!0,sessionStorage.removeItem(_),o(),new MutationObserver(o).observe(r,{childList:!0,subtree:!0})}catch{const o=P(),i=Date.now()-o.t>O?0:o.c;i<L?(r.innerHTML=['<div style="padding:24px;text-align:center;font-family:system-ui,sans-serif">','<p style="color:#3b82f6;font-weight:600;margin:0 0 4px">Loading dependencies...</p>','<p style="color:#3b82f6;opacity:0.7;font-size:12px;margin:0">Reloading automatically</p>',"</div>"].join(""),sessionStorage.setItem(_,JSON.stringify({c:i+1,t:Date.now()})),setTimeout(()=>location.reload(),3e3+i*1e3)):r.innerHTML=['<div style="padding:24px;text-align:center;font-family:system-ui,sans-serif">','<p style="color:#c0392b;font-weight:600;margin:0 0 4px">Failed to load dependencies</p>','<p style="color:#c0392b;opacity:0.8;font-size:12px;margin:0">Please refresh the page</p>',"</div>"].join("")}}R();export{y as _};
|
quanxue/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
<title>劝学 · 荀子 | 课文精讲(网页实时渲染视频)</title>
|
| 9 |
<script>document.documentElement.classList.add('dark');</script>
|
| 10 |
<style>html,body{background:#0b0a08;margin:0}</style>
|
| 11 |
-
<script type="module" crossorigin src="./assets/quanxue-
|
| 12 |
<link rel="stylesheet" crossorigin href="./assets/quanxue-CY64PIWa.css">
|
| 13 |
</head>
|
| 14 |
<body>
|
|
|
|
| 8 |
<title>劝学 · 荀子 | 课文精讲(网页实时渲染视频)</title>
|
| 9 |
<script>document.documentElement.classList.add('dark');</script>
|
| 10 |
<style>html,body{background:#0b0a08;margin:0}</style>
|
| 11 |
+
<script type="module" crossorigin src="./assets/quanxue-b6n75eFe.js"></script>
|
| 12 |
<link rel="stylesheet" crossorigin href="./assets/quanxue-CY64PIWa.css">
|
| 13 |
</head>
|
| 14 |
<body>
|