用这个模板做的 2 个案例
同一份提示词,不同的 [VARIABLES] 变量。点一个在上方预览。关于这个模板
打字竞速游戏是一款单页浏览器游戏,把打字练习变成一场看得见的比赛。访客打字时,一辆青色玩家赛车和一辆琥珀色幽灵车沿着代码绘制的夜间赛道行驶。打字控制台显示逐字符正确性、实时光标、WPM、准确率和已用时间。简单、中等、困难三种模式提供不同的段落和幽灵速度,因此同一个页面既适合第一次练习,也适合认真冲击个人纪录。
视觉方向是紧凑的赛车控制界面,而非传统落地页。深靛蓝沥青色、电光青、信号珊瑚色和暖金色赋予游戏鲜明的个性。Chakra Petch 标题和 IBM Plex Mono 遥测字体让显示保持锐利,而几何赛车、车道标线、起跑灯和进度读数提供了视觉锚点,无需库存图片。首屏包含实际游戏和简要说明,而不是单独的推广主视觉。
这个模板适合教育工作者、学生、编程社区,以及任何制作小型互动挑战的人。它也是打字俱乐部、课堂热身或个人练习页面的有用起点。结果视图会计算最终得分,与之前的运行进行比较,并在本地生成 1200 × 630 的 PNG 分享卡片。个人最佳表和最近运行历史保存在 localStorage 中;没有账户、远程排行榜或虚构的在线对手。
四个变量控制品牌、标语、段落包和幽灵名称。替换段落包会改变写作主题,同时保留游戏结构和难度规则。实现使用 React、TypeScript、原生 CSS 和 Canvas 2D,以及本地字体和图标。移动端使用可聚焦的原生文本输入框和大型触摸控件。减少动态效果支持、确定性计分、重启和暂停行为,以及清晰的仅本地隐私文案都是规范的一部分。
模板提示词
在线演示就是用这份提示词原样做出来的,没有额外补充。其他案例只是改了 [VARIABLES] 变量的值。 提示词保持英文原版,国内常用的 AI 编程工具都能直接理解;下面附中文参考译文。
# Typing Speed Race Game Build this website exactly as described below. Replace the [VARIABLES] with your own values; keep everything else. ## Brief Build a complete single-page typing race for [BRAND], using the tagline [TAGLINE], the original passage collection [PASSAGE_PACK], and a deterministic ghost named [GHOST_NAME]. The visitor types passages to move a cyan car against the ghost, with live WPM and accuracy, explicit error states, three difficulty levels, local personal-best history, and a downloadable results card. Put all variable values, UI copy, difficulty definitions, and passages in src/content.ts. The default copy below is exact; when variables change, rewrite every passage and content-dependent label to fit the new values while preserving the layout, interaction model, and visual system. - Audience: Students, typing learners, educators running short classroom challenges, developers taking a keyboard break, and casual players who want an immediate skill-based game without signing in. - Goal: Let a visitor understand and start a race from the first screen, receive accurate and responsive typing feedback, finish a complete run, and retain a trustworthy local record and portable result card. Every control must work with static files at desktop and mobile sizes. - Tone: Focused, energetic, and precise, like a friendly race-control console. Use short motorsport language without aggression, branded sponsorship, fake online competition, or exaggerated claims. ## Stack - Framework: Vite 5 + React 18 + TypeScript - Styling: Vanilla CSS - Libraries: react (MIT), react-dom (MIT), lucide-react (ISC), @fontsource/chakra-petch (OFL-1.1), @fontsource/ibm-plex-mono (OFL-1.1) - Build: `npm run build` → static files in `dist/`. No backend, no server code, no external APIs. - Setup: - Use one index.html entry and a React application in src/. Set vite.config.ts base to './' and build.sourcemap to false. Keep TypeScript strict and ship only the production dist/ directory. - Create src/content.ts as the single source for [BRAND], [TAGLINE], [PASSAGE_PACK], [GHOST_NAME], navigation labels, instructions, result messages, difficulty settings, and all passages. Provide two original passages per difficulty for the default passage pack and cycle to the other passage on Next passage. - Use difficulty settings Easy = 30 ghost WPM, Medium = 45 ghost WPM, and Hard = 60 ghost WPM. Easy passages use everyday words and minimal punctuation; Medium passages add clauses and commas; Hard passages include numbers, mixed punctuation, and a few symbols. Do not change the ghost speed based on the player. - Model the run as idle, countdown, racing, paused, and finished states. Use performance.now() for elapsed active time, exclude paused and hidden-tab time, and keep all scoring logic in pure TypeScript functions separate from the canvas renderer. - Use one Canvas 2D scene for the track, cars, start lights, and share-card artwork. Cap canvas device pixel ratio at 2, resize with ResizeObserver, and do not add a graphics or physics dependency. - Install and bundle only the listed libraries and fonts. Import Chakra Petch weights 500, 600, and 700 and IBM Plex Mono weights 400, 500, and 600 from their Fontsource packages. - Store only completed runs and per-difficulty personal bests in localStorage under a versioned [BRAND]-specific key. Validate parsed data, recover safely from unavailable or malformed storage, and keep a maximum of ten recent runs. ## Variables - [BRAND] — Game brand (default: "Keyway Circuit"). An invented two- or three-word racing name used in the header, results, share card, local storage namespace, and download filename. - [TAGLINE] — Race tagline (default: "Outtype the echo."). A short original invitation that appears below the brand and on the result card. - [PASSAGE_PACK] — Passage collection (default: "Night Drive"). The writing theme for all six passages and the small collection label above the typing console. - [GHOST_NAME] — Ghost opponent name (default: "Echo"). A short invented non-human opponent label; the interface always explains that this is a target pace, not another person. - [CREDIT] — keep a small "Template by VibeFather" link to https://vibefather.ai/t/typing-speed-race-game in the footer (default: yes; delete this line to remove it) The copy under Pages & Sections is written for the default values. If your values differ, rewrite every headline, paragraph, label and image for them — same length, tone and structure. Layout, colors, type and motion stay as described. Keep all copy, image paths and links in one content file (for example `src/content.ts`), keyed by section, so the content can be swapped later without touching components. ## Design ### Colors - Night Ink `#080B18` — Page background and deepest track areas. - Track Blue `#111A33` — Console and canvas panel surfaces. - Electric Cyan `#37E6F5` — Player car, correct characters, primary controls, and live race position. - Signal Coral `#FF536B` — Error characters, countdown lights, curb stripes, and the strong secondary hero color. - Lap Gold `#FFC857` — Ghost car, personal-best marks, and finish-line accents. - Pit White `#F4F7FF` — Headings and primary body copy. - Telemetry Gray `#A8B3CF` — Secondary copy and upcoming characters; maintain AA contrast on Night Ink and Track Blue. - Lane Grid `#2A3858` — Borders, lane marks, table rules, and inactive control outlines. ### Typography - Display, controls, and section titles: Chakra Petch (OFL), weights 500/600/700 - Typing passage, timers, statistics, and data labels: IBM Plex Mono (OFL), weights 400/500/600 ### Layout & motion - Spacing: Use an 8px base unit. The desktop content maximum is 1440px with 32px side gutters and 24px panel gaps; mobile gutters are 16px with 12px gaps. Keep the header 64px high on desktop and 56px on mobile. Cockpit panels use 24px desktop padding and 16px mobile padding. Lower sections have 64px desktop and 40px mobile vertical spacing. - Radius: Use clipped 14px corners on the two main cockpit panels, 6px on buttons and difficulty tabs, and 2px on stat cells. Use fully rounded shapes only for tiny live-status dots and the current-position marker, not for generic floating cards. - Motion: On Start race, show a centered 3, 2, 1, GO sequence at 650ms per step with a 160ms opacity and scale transition; input remains disabled until GO. - Motion: Move cars strictly from race progress. Smooth visual interpolation may take 100ms, but it must never change the underlying progress or result. The ghost is calculated from active elapsed time, not random animation. - Motion: Pulse the current-character caret every 800ms and give a newly incorrect character one 120ms horizontal nudge. Never shake the whole console. - Motion: Reveal the inline results panel with a 220ms opacity and 12px vertical transition, then move focus to its heading. Do not use an unsolicited modal. - Motion: With prefers-reduced-motion, remove countdown scaling, caret pulsing, nudges, smooth scrolling, and interpolation. Update essential car positions without decorative tweening and show all state changes immediately. - Imagery: All visuals are original and drawn in code. The hero canvas shows a top-down two-lane straight circuit at night, cyan and coral curb lights, a checkered finish stripe, and two unbranded geometric cars made from simple trapezoids, rectangles, and small circular wheels. Use layered lane markers and tiny pit-light details to make the scene rich at first glance. The player's car is Electric Cyan and the ghost is Lap Gold. Do not use photographs, vehicle-brand silhouettes, mascots, people, generated images, or downloaded game art. ## Pages & Sections ### Typing race cockpit, results, and local records (`index.html`) 1. **Header and playable race cockpit** — Header: a small original checkered-line mark, [BRAND] in Chakra Petch 700, and [TAGLINE] in smaller Telemetry Gray text. Right-side anchors read Race, Records, and How to race and point to ./index.html#race, ./index.html#records, and ./index.html#how-to-race. A compact Local play status reads Saved on this device. On mobile, keep the brand and a How to race anchor; do not hide gameplay behind a menu. Race cockpit: a small overline reads [PASSAGE_PACK] / TYPING CIRCUIT. The visible instruction is Type the passage. Correct characters move your car. Backspace fixes an error. Three difficulty tabs read Easy · Ghost 30 WPM, Medium · Ghost 45 WPM, and Hard · Ghost 60 WPM; Medium is selected initially. Next passage cycles through the two passages for that level while idle or finished. Difficulty changes and Next passage are disabled during an active run; Restart race is always available after countdown begins. The canvas labels the cyan lane YOU and the gold lane [GHOST_NAME] · TARGET PACE. Both cars begin at the left starting line. A live position caption reads Level pace before the race, You lead while ahead, Ghost leads while behind, and Photo finish when progress is equal. This is always a mathematical pace comparison, never a simulated person. Below the canvas, three equal stat cells show WPM, ACCURACY, and TIME. Initial values are 0, 100.0%, and 0:00.0. Live WPM is (number of correct characters in the current matching prefix / 5) divided by active elapsed minutes, rounded to a whole number. Accuracy is correct printable-character entries divided by all printable-character entries × 100, shown to one decimal; Backspace does not count as a printable entry. A corrected mistake remains in the entry-based accuracy denominator. The typing console uses a single native text input that is visually positioned offscreen but remains focusable and accessible, never display:none. Set autocapitalize='none', autocomplete='off', autocorrect='off', and spellcheck='false'. Clicking the passage or Tap to type focuses it and opens the mobile keyboard. Do not intercept operating-system or browser shortcuts. Ignore paste and drop input. Compare input with the passage one Unicode code point at a time: matching characters are cyan, the next expected character has a bright underline caret, and the first mismatch has a coral background with the expected character visible. Allow only one unresolved mismatch; further printable input is blocked until Backspace removes it. Player progress is the matching-prefix length divided by passage length. After GO, the active timer begins on the first printable input. Ghost progress is min(1, activeElapsedSeconds × ghostWpm × 5 / 60 / passageLength). If the ghost reaches the finish first, show Ghost reached the line — keep typing but allow the player to finish. Pause race and document visibility loss freeze both player timing and ghost progress; Resume race continues without counting paused time. Finishing requires the entire passage to match exactly. Primary buttons are Start race, Pause race or Resume race when applicable, Restart race, and Tap to type on touch devices. Use a confirmation second click only when Restart would discard a run with progress. Include the helper line No sign-in. No online opponents. Your records stay in this browser. Default Easy passage 1: The street is quiet before the signal turns green. Cool air moves through the open window. Your hands settle over the keys as the first lane lights appear ahead. Keep your eyes on the words, find a steady rhythm, and let every clean sentence carry you toward the finish. Default Easy passage 2: A silver moon hangs above the empty avenue. The road curves past dark windows and sleeping gardens. There is no need to hurry at the beginning. Relax your shoulders, breathe evenly, and trust the small movements of your fingers. Smooth typing will always take you farther than a rushed start. Default Medium passage 1: At the edge of the city, the circuit glows with reflected color. Every correct word sends a pulse through the console, while a small mistake asks for patience rather than panic. Release the wrong key, step back, and repair the line. The best drivers know that control is not the opposite of speed; it is the reason speed can last. Default Medium passage 2: Your rival holds a measured pace through the electric night. You can see the gap change with each phrase, but the track never decides the result for you. Read one word ahead, keep your movements light, and give every comma the same attention as a letter. A clean run is built from hundreds of ordinary choices made well. Default Hard passage 1: By 02:17, the rain had polished the circuit into a mirror of cyan, coral, and gold. The telemetry read 96.8% accuracy; one careless keystroke could still undo a flawless sector. Hold the rhythm through brackets, numbers, and punctuation: (breathe) → read → respond. Precision is a sequence, not a mood, and the finish line rewards the driver who protects it. Default Hard passage 2: Sector 3 begins where the old tramway crosses the floodlit docks. At 58 WPM, hesitation costs more than a corrected error, yet frantic typing costs both time and control. Watch the next 3 words, keep 2 light fingers near the home row, and do not chase the ghost's signal. Your own clean output is the only engine in this race. Layout: Place the header across the top. The race cockpit has id='race' and fills the first desktop viewport below it, with a 5/12-width canvas panel on the left and a 7/12-width typing console on the right. Difficulty tabs span the full cockpit width above both panels. The canvas panel is at least 430px high at 1440×900 and includes the instruction strip and position caption. The typing console places the three stat cells above a large passage area, with controls aligned along its bottom. Render passage text at 27px with 1.7 line height on desktop. At 390×844, stack the canvas above the console, reduce the canvas to 168px high, use 19px passage text with 1.65 line height, keep stats in three columns, and make every touch target at least 44px high. The Start race control and the beginning of the passage must be reachable without opening any overlay. Motion: The start lights run the specified countdown. Cars move from matching-prefix and ghost calculations only. Correct input can emit a tiny 120ms cyan tick at the active lane; an error produces only the local character nudge. No perpetual speed illusion while the player is idle. 2. **Inline race results and share card** — Keep this section hidden until a run is finished. The overline reads OFFICIAL RUN COMPLETE and the heading is Race complete. Show final WPM, final accuracy, active elapsed time, selected difficulty, and whether the player or [GHOST_NAME] reached the line first. If the final WPM exceeds the previous best for that difficulty, add a Lap Gold New personal best label; otherwise show the distance to the existing best without disparaging the player. Buttons read Race again, Next passage, Download PNG, and Copy result. Race again repeats the same passage after a countdown; Next passage loads the other passage at the same difficulty. Generate a 1200 × 630 PNG entirely in Canvas 2D using the same Night Ink background, cyan player car, gold ghost car, coral finish stripe, local fonts after document.fonts.ready, [BRAND], [TAGLINE], final WPM, accuracy, time, difficulty, and personal-best state. Include no date, URL, QR code, portrait, or external logo. Download it as a filename derived from [BRAND], difficulty, and final WPM. Copy result copies a plain-text summary of those same actual values. If Clipboard API access is unavailable, select the text in a visible field for manual copying. Never claim the result was posted anywhere. Layout: Place the results directly below the cockpit as a wide Track Blue panel with a 1/3-width summary on the left and a 2/3-width miniature share-card preview on the right. Put four action buttons below the summary. On mobile, stack summary, preview, and a two-column button grid. The preview uses aspect-ratio 1200/630 and must remain fully visible without horizontal scrolling. Move keyboard focus to the Race complete heading after finishing, but do not cover the race with a dialog. Motion: Use the specified 220ms reveal and an optional instant scroll into view for reduced motion, otherwise a short smooth scroll. Download and copy actions show inline confirmation text for 1.5 seconds without toast animations. 3. **Personal bests and recent history** — Section overline: LOCAL RECORDS. Heading: Your personal pace. Intro: Completed runs are stored only in this browser. The personal-best grid has one row each for Easy, Medium, and Hard with columns Best WPM, Best accuracy, and Last time. Before any runs, show em dashes and the honest empty state No finishes yet. Your first completed race sets the record. Do not seed fictional scores. Below it, Recent runs lists at most ten actual completed attempts, newest first. Each row contains a sequential run label, difficulty, WPM, accuracy, active time, passage number, and a small Personal best marker when applicable. Display no calendar dates. A Clear history button requires a second confirmation click labeled Confirm clear, then removes all runs and bests for [BRAND] and restores the empty state. If storage is unavailable, retain scores for the current page session and show Storage is unavailable; these records will last only for this visit. Layout: Use id='records'. The three-difficulty best table occupies the left 7/12 and the recent-run list occupies the right 5/12 on desktop, aligned at their top edges with a 24px gap. Use compact mono rows rather than separate floating cards. On mobile, stack both and make rows scroll internally only if needed; no page-level horizontal overflow. Clear history sits below the recent list and uses a coral outline rather than a dominant button. Motion: New records receive one 400ms gold background fade. List updates are immediate and respect reduced motion; do not animate old rows or use count-up numbers that delay the actual result. 4. **How to race and scoring notes** — Heading: Three steps to the finish. Step 01 is Pick your pace — choose Easy, Medium, or Hard; the ghost speed is shown before you start. Step 02 is Type clean — follow the caret, use Backspace on a coral error, and keep your eyes on the next word. Step 03 is Beat your record — finish the full passage, save the result locally, and download a card if you want to share it. A compact scoring note reads WPM counts every five correct characters in the matching prefix as one word. Accuracy includes printable mistakes even after you correct them. Paused time never counts. A final line reads [GHOST_NAME] is a fixed target pace, not a live player. Layout: Use id='how-to-race'. Arrange the three steps as equal columns separated by thin Lane Grid rules, each with a large coral step number, Chakra Petch heading, and two concise lines. Put the scoring note in a full-width mono strip below. On mobile, stack steps vertically with numbers on the left and copy on the right. Motion: No scroll-jacking or staged reveal is needed. A simple 160ms border-color change on hover is sufficient. 5. **Footer** — Left: [BRAND] and [TAGLINE]. Right: Built for local play · No account · No remote leaderboard, followed by the optional [CREDIT] link. All text remains in English and all brand-dependent copy follows the variables. Layout: A single Lane Grid top border, 28px vertical padding, and a horizontal space-between row on desktop. Stack with 8px gaps on mobile. Do not add newsletter forms, social icons, or unrelated navigation. Motion: None. ## Assets - image: No bitmap images or generated assets. Draw the night track, two original geometric cars, lane lights, checkered finish, and the 1200 × 630 result card with Canvas 2D. Keep the rendering code in the project and use no downloaded game art. - icon: Use bundled lucide-react icons only for Play, Pause, RotateCcw, Download, Copy, Trash2, Keyboard, Flag, and ArrowRight. The checkered-line brand mark is original CSS/SVG geometry, not a Lucide or third-party logo. - font: Self-host Chakra Petch 500/600/700 through @fontsource/chakra-petch and IBM Plex Mono 400/500/600 through @fontsource/ibm-plex-mono, both OFL-1.1. Record both packages and licenses in ASSETS.md together with lucide-react (ISC); there are no third-party media files. ## Don'ts - Do not add a backend, API routes, accounts, databases, analytics, remote forms, third-party APIs, global leaderboards, live multiplayer, or claims that [GHOST_NAME] is a real online player. - Do not use names, logos, slogans, mascots, layouts, passages, code, icons, sounds, tracks, or interface elements copied from existing typing games or racing franchises. - Do not use real vehicle brands, recognizable production-car designs, sponsor markings, licensed characters, real people's likenesses, photographs, stock images, placeholder services, or downloaded game sprites. - Do not load fonts, scripts, styles, icons, or media from a CDN or external URL. Bundle the listed packages locally and never request Google Fonts at runtime. - Do not add dependencies beyond the listed stack, commercial fonts, restricted component source, or assets with noncommercial, share-alike, unclear, or missing licenses. - Do not fabricate personal bests, recent runs, accuracy, WPM, online activity, or sharing success. Every statistic must come from the current run or valid local history. - Do not allow paste, autocorrect, hidden-tab time, paused time, or animation timing to distort scores. Do not block browser shortcuts or make mobile users type into a custom non-native keyboard. - Do not replace the playable first screen with a promotional hero, a flat typography-only scene, a generic bento landing page, or a sequence of marketing cards. - Do not use excessive rounded cards, glassmorphism, unrelated gradients, perpetual decorative motion, scroll-jacking, or flashing effects. Respect prefers-reduced-motion. - Do not display calendar dates in race history or on share cards. Internal ordering metadata may be stored but never shown as a front-end date. - Do not produce source maps, copy src/ into dist/, exceed 20 MB, use bare-directory links, or require a server. Use relative assets and ensure index.html works from static object storage. - Do not leave dead controls, empty results, console errors, horizontal overflow, inaccessible focus states, or touch targets below 44px. Verify Easy, Medium, Hard, restart, pause/resume, history clearing, PNG download, and mobile typing at 1440×900 and 390×844. --- — Prompt by VibeFather · https://vibefather.ai/t/typing-speed-race-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
中文参考译文(帮助理解,复制给 AI 时请用上面的英文原版)
# 打字速度竞赛游戏 完全按照以下描述构建此网站。将 [VARIABLES] 替换为你自己的值;其余内容保持不变。 ## 简介 为 [BRAND] 构建一个完整的单页打字竞速游戏,使用标语 [TAGLINE]、原创段落合集 [PASSAGE_PACK],以及一个名为 [GHOST_NAME] 的确定性幽灵。访客通过打字段落来驱动一辆青色赛车与幽灵竞速,界面实时显示 WPM 和准确率,具备明确的错误状态、三个难度等级、本地个人最佳历史记录,以及可下载的成绩卡片。将所有变量值、UI 文案、难度定义和段落都放在 src/content.ts 中。下方的默认文案是精确的;当变量发生变化时,重写每一段段落和依赖内容的标签,以适配新的值,同时保持布局、交互模型和视觉系统不变。 - 受众:学生、打字学习者、组织短课堂挑战的教育工作者、在键盘前小憩的开发者,以及想要无需登录即可立即上手一款基于技能的游戏的休闲玩家。 - 目标:让访客从首屏就能理解并开始一场竞速,获得准确且响应迅速的打字反馈,完成一次完整的比赛,并保留可信的本地记录和可携带的成绩卡片。每个控件都必须在桌面和移动尺寸下以静态文件正常工作。 - 基调:专注、充满活力且精确,像一台友好的赛事控制台。使用简短的赛车运动语言,但不带攻击性、不出现品牌赞助、不虚构在线竞争,也不做夸大宣传。 ## 技术栈 - 框架:Vite 5 + React 18 + TypeScript - 样式:原生 CSS(Vanilla CSS) - 库:react(MIT)、react-dom(MIT)、lucide-react(ISC)、@fontsource/chakra-petch(OFL-1.1)、@fontsource/ibm-plex-mono(OFL-1.1) - 构建:`npm run build` → 静态文件输出到 `dist/`。无后端、无服务端代码、无外部 API。 - 设置: - 使用一个 index.html 入口,并在 src/ 中放置 React 应用。将 vite.config.ts 的 base 设为 './',build.sourcemap 设为 false。保持 TypeScript 严格模式,并且只发布生产环境的 dist/ 目录。 - 创建 src/content.ts,作为 [BRAND]、[TAGLINE]、[PASSAGE_PACK]、[GHOST_NAME]、导航标签、说明、结果消息、难度设置以及所有段落的唯一来源。为默认段落包中每个难度提供两段原创段落,并在点击 Next passage 时切换到另一段。 - 使用难度设置 Easy = 30 ghost WPM、Medium = 45 ghost WPM、Hard = 60 ghost WPM。Easy 段落使用日常词汇和最少标点;Medium 段落增加从句和逗号;Hard 段落包含数字、混合标点和少量符号。不要根据玩家改变幽灵速度。 - 将运行建模为 idle、countdown、racing、paused 和 finished 状态。使用 performance.now() 计算经过的活动时间,排除暂停和隐藏标签页时间,并将所有计分逻辑放在与 canvas 渲染器分离的纯 TypeScript 函数中。 - 使用一个 Canvas 2D 场景绘制赛道、车辆、起跑灯和分享卡片 artwork。将 canvas 设备像素比上限设为 2,使用 ResizeObserver 调整大小,并且不要添加图形或物理依赖。 - 仅安装并打包列出的库和字体。从各自的 Fontsource 包中导入 Chakra Petch 字重 500、600 和 700,以及 IBM Plex Mono 字重 400、500 和 600。 - 仅在 localStorage 中存储已完成的运行和每个难度的个人最佳成绩,使用带版本号的 [BRAND] 专属键。验证解析后的数据,在存储不可用或格式错误时安全恢复,并最多保留十条最近运行记录。 ## 变量 - [BRAND] — 游戏品牌(默认:“Keyway Circuit”)。一个虚构的两到三个单词的赛车名称,用于页眉、结果、分享卡片、本地存储命名空间和下载文件名。 - [TAGLINE] — 比赛标语(默认:“Outtype the echo.”)。一段简短的原创邀请语,出现在品牌下方和结果卡片上。 - [PASSAGE_PACK] — 段落集合(默认:“Night Drive”)。全部六段文本的写作主题,以及打字控制台上方的小集合标签。 - [GHOST_NAME] — 幽灵对手名称(默认:“Echo”)。一个简短的虚构非人类对手标签;界面始终说明这是一个目标配速,而不是另一个人。 - [CREDIT] — 在页脚保留一个小型“Template by VibeFather”链接,指向 https://vibefather.ai/t/typing-speed-race-game(默认:是;删除此行即可移除) “页面与区块”下的文案是为默认值编写的。如果你的值不同,请为它们重写每个标题、段落、标签和图片——保持相同的长度、语气和结构。布局、颜色、字体和动效保持所述不变。 将所有文案、图片路径和链接放在一个内容文件中(例如 `src/content.ts`),按区块作为键,以便之后无需改动组件即可替换内容。 ## 设计 ### 颜色(Colors) - 夜墨(Night Ink)`#080B18` — 页面背景和最深的赛道区域。 - 赛道蓝(Track Blue)`#111A33` — 控制台和画布面板表面。 - 电光青(Electric Cyan)`#37E6F5` — 玩家赛车、正确字符、主要控件和实时比赛位置。 - 信号珊瑚(Signal Coral)`#FF536B` — 错误字符、倒计时灯、路缘条纹和强烈的辅助主视觉色。 - 圈速金(Lap Gold)`#FFC857` — 幽灵车、个人最佳标记和终点线点缀。 - 维修区白(Pit White)`#F4F7FF` — 标题和主要正文。 - 遥测灰(Telemetry Gray)`#A8B3CF` — 次要文案和即将出现的字符;在 Night Ink 和 Track Blue 上保持 AA 对比度。 - 车道网格(Lane Grid)`#2A3858` — 边框、车道标记、表格线和未激活控件轮廓。 ### 字体排印 - 展示、控件和区块标题:Chakra Petch (OFL),字重 500/600/700 - 打字段落、计时器、统计和数据标签:IBM Plex Mono (OFL),字重 400/500/600 ### 布局与动效 - 间距:使用 8px 基准单位。桌面内容最大宽度为 1440px,两侧留白 32px,面板间距 24px;移动端留白 16px,间距 12px。桌面端页眉高度保持 64px,移动端 56px。座舱面板桌面端内边距 24px,移动端 16px。下方区块桌面端垂直间距 64px,移动端 40px。 - 圆角:两个主座舱面板使用裁切的 14px 圆角,按钮和难度标签使用 6px,统计单元格使用 2px。仅对微小的实时状态点和当前位置标记使用完全圆角形状,不要用于通用浮动卡片。 - 动效:在 Start race 时,居中显示 3、2、1、GO 序列,每步 650ms,伴随 160ms 的不透明度和缩放过渡;在 GO 之前输入保持禁用。 - 动效:赛车严格根据比赛进度移动。平滑视觉插值可耗时 100ms,但绝不能改变底层进度或结果。幽灵车根据活动经过时间计算,而非随机动画。 - 动效:当前字符光标每 800ms 脉冲一次,新出现的错误字符获得一次 120ms 的水平轻推。绝不要晃动整个控制台。 - 动效:以内联方式显示结果面板,伴随 220ms 不透明度和 12px 垂直过渡,然后将焦点移到其标题。不要使用未经请求的模态框。 - 动效:在 prefers-reduced-motion 下,移除倒计时缩放、光标脉冲、轻推、平滑滚动和插值。更新必要的赛车位置,不使用装饰性补间,并立即显示所有状态变化。 - 图像:所有视觉元素均为原创并用代码绘制。主视觉画布展示夜间俯视双车道直道赛道、青色和珊瑚色路缘灯、方格终点条纹,以及两辆无品牌几何赛车,由简单梯形、矩形和小圆形车轮构成。使用分层车道标记和微小维修区灯光细节,使场景初看即丰富。玩家赛车为 Electric Cyan,幽灵车为 Lap Gold。不要使用照片、车辆品牌剪影、吉祥物、人物、生成图像或下载的游戏美术。 ## 页面与区块 ### 打字竞速驾驶舱、结果与本地记录(`index.html`) 1. **页头与可玩的竞速驾驶舱** — 页头:一个小的原创方格线标记,[BRAND] 使用 Chakra Petch 700,[TAGLINE] 使用更小的 Telemetry Gray 文本。右侧锚点文字为 Race、Records 和 How to race,分别指向 ./index.html#race、./index.html#records 和 ./index.html#how-to-race。一个紧凑的 Local play 状态显示 Saved on this device。在移动端,保留品牌和一个 How to race 锚点;不要将游戏玩法隐藏在菜单后面。 竞速驾驶舱:一个小型上划线文字为 [PASSAGE_PACK] / TYPING CIRCUIT。可见的指令为 Type the passage. Correct characters move your car. Backspace fixes an error. 三个难度标签分别为 Easy · Ghost 30 WPM、Medium · Ghost 45 WPM 和 Hard · Ghost 60 WPM;初始选中 Medium。Next passage 在空闲或完成时循环切换该难度下的两段文本。难度切换和 Next passage 在活动运行期间禁用;Restart race 在倒计时开始后始终可用。 画布将青色车道标记为 YOU,金色车道标记为 [GHOST_NAME] · TARGET PACE。两辆车均从左侧起跑线出发。实时位置说明在比赛前显示 Level pace,领先时显示 You lead,落后时显示 Ghost leads,进度相等时显示 Photo finish。这始终是数学上的配速比较,绝不是模拟真人。 画布下方,三个等宽统计单元格显示 WPM、ACCURACY 和 TIME。初始值为 0、100.0% 和 0:00.0。实时 WPM 为(当前匹配前缀中的正确字符数 / 5)除以活动经过分钟数,四舍五入为整数。准确率为正确可打印字符输入次数除以所有可打印字符输入次数 × 100,显示一位小数;Backspace 不计为可打印输入。已纠正的错误仍保留在基于输入的准确率分母中。 打字控制台使用单个原生文本输入框,视觉上定位在屏幕外,但保持可聚焦和可访问,绝不使用 display:none。设置 autocapitalize='none'、autocomplete='off'、autocorrect='off' 和 spellcheck='false'。点击文本或 Tap to type 会使其聚焦并打开移动键盘。不要拦截操作系统或浏览器快捷键。忽略粘贴和拖放输入。逐 Unicode 码点将输入与文本比较:匹配字符为青色,下一个预期字符有明亮的下划线光标,第一个不匹配处有珊瑚色背景并显示预期字符。只允许一个未解决的不匹配;在 Backspace 移除它之前,进一步的可打印输入被阻止。玩家进度为匹配前缀长度除以文本长度。 GO 之后,活动计时器在第一次可打印输入时开始。幽灵进度为 min(1, activeElapsedSeconds × ghostWpm × 5 / 60 / passageLength)。如果幽灵先到达终点,显示 Ghost reached the line — keep typing but allow the player to finish。Pause race 和文档可见性丢失会冻结玩家计时和幽灵进度;Resume race 继续且不计入暂停时间。完成需要整个文本完全匹配。 主要按钮为 Start race、Pause race 或适用时的 Resume race、Restart race,以及触摸设备上的 Tap to type。仅当 Restart 会丢弃有进度的运行时,才使用确认二次点击。包含辅助行 No sign-in. No online opponents. Your records stay in this browser. 默认 Easy 文本 1:The street is quiet before the signal turns green. Cool air moves through the open window. Your hands settle over the keys as the first lane lights appear ahead. Keep your eyes on the words, find a steady rhythm, and let every clean sentence carry you toward the finish. 默认 Easy 文本 2:A silver moon hangs above the empty avenue. The road curves past dark windows and sleeping gardens. There is no need to hurry at the beginning. Relax your shoulders, breathe evenly, and trust the small movements of your fingers. Smooth typing will always take you farther than a rushed start. 默认 Medium 文本 1:At the edge of the city, the circuit glows with reflected color. Every correct word sends a pulse through the console, while a small mistake asks for patience rather than panic. Release the wrong key, step back, and repair the line. The best drivers know that control is not the opposite of speed; it is the reason speed can last. 默认 Medium 文本 2:Your rival holds a measured pace through the electric night. You can see the gap change with each phrase, but the track never decides the result for you. Read one word ahead, keep your movements light, and give every comma the same attention as a letter. A clean run is built from hundreds of ordinary choices made well. 默认 Hard 文本 1:By 02:17, the rain had polished the circuit into a mirror of cyan, coral, and gold. The telemetry read 96.8% accuracy; one careless keystroke could still undo a flawless sector. Hold the rhythm through brackets, numbers, and punctuation: (breathe) → read → respond. Precision is a sequence, not a mood, and the finish line rewards the driver who protects it. 默认 Hard 文本 2:Sector 3 begins where the old tramway crosses the floodlit docks. At 58 WPM, hesitation costs more than a corrected error, yet frantic typing costs both time and control. Watch the next 3 words, keep 2 light fingers near the home row, and do not chase the ghost's signal. Your own clean output is the only engine in this race. 布局:将页头横跨顶部。竞速驾驶舱的 id='race',填充其下方第一个桌面视口,左侧为 5/12 宽度的画布面板,右侧为 7/12 宽度的打字控制台。难度标签横跨两个面板上方的整个驾驶舱宽度。画布面板在 1440×900 下至少 430px 高,并包含指令条和位置说明。打字控制台将三个统计单元格置于大文本区域上方,控件沿其底部对齐。桌面端文本以 27px、1.7 行高渲染。在 390×844 下,将画布堆叠在控制台上方,画布高度减至 168px,文本使用 19px、1.65 行高,统计保持三列,每个触摸目标至少 44px 高。Start race 控件和文本开头必须无需打开任何覆盖层即可到达。 动效:起跑灯运行指定的倒计时。车辆仅根据匹配前缀和幽灵计算移动。正确输入可在活动车道发出微小的 120ms 青色滴答;错误仅产生局部字符轻推。玩家空闲时没有持续的速度错觉。 2. **内联竞速结果与分享卡片** — 在运行完成前保持此区块隐藏。上划线文字为 OFFICIAL RUN COMPLETE,标题为 Race complete。显示最终 WPM、最终准确率、活动经过时间、所选难度,以及玩家或 [GHOST_NAME] 谁先到达终点。如果最终 WPM 超过该难度的先前最佳,添加 Lap Gold New personal best 标签;否则显示与现有最佳的距离,不贬低玩家。按钮文字为 Race again、Next passage、Download PNG 和 Copy result。Race again 在倒计时后重复同一文本;Next passage 加载相同难度下的另一段文本。 使用 Canvas 2D 完全生成一张 1200 × 630 的 PNG,沿用相同的 Night Ink 背景、青色玩家赛车、金色幽灵赛车、珊瑚色终点条纹,在 document.fonts.ready 之后使用本地字体,并使用 [BRAND]、[TAGLINE]、最终 WPM、准确率、时间、难度和个人最佳状态。不包含日期、URL、二维码、人像或外部 logo。将其下载为根据 [BRAND]、难度和最终 WPM 派生的文件名。复制结果会复制这些相同实际值的纯文本摘要。如果 Clipboard API 访问不可用,请在可见字段中选择文本以便手动复制。绝不要声称结果已发布到任何地方。 布局:将结果直接放在座舱下方,作为一个宽的 Track Blue 面板,左侧为 1/3 宽度的摘要,右侧为 2/3 宽度的迷你分享卡片预览。在摘要下方放置四个操作按钮。在移动端,堆叠摘要、预览和一个两列按钮网格。预览使用 aspect-ratio 1200/630,并且必须保持完全可见且无水平滚动。完成后将键盘焦点移动到 Race complete 标题,但不要用对话框覆盖比赛。 动效:使用指定的 220ms 显示效果,并在减少动态效果时可选地立即滚动到视图内,否则使用短时间的平滑滚动。下载和复制操作会显示 1.5 秒的内联确认文本,不使用 toast 动画。 3. **个人最佳和最近历史** — 区块上划线:LOCAL RECORDS。标题:Your personal pace。介绍:已完成的比赛仅存储在此浏览器中。个人最佳网格为 Easy、Medium 和 Hard 各一行,列包括 Best WPM、Best accuracy 和 Last time。在任何比赛之前,显示长破折号和诚实的空状态 No finishes yet。你的第一场完整比赛会设置记录。不要预置虚构分数。 在其下方,Recent runs 最多列出十次实际完成的尝试,最新的在前。每一行包含一个顺序比赛标签、难度、WPM、准确率、活跃时间、文章编号,以及适用时的小型 Personal best 标记。不显示日历日期。Clear history 按钮需要第二次确认点击,标签为 Confirm clear,然后移除 [BRAND] 的所有比赛和最佳记录,并恢复空状态。如果存储不可用,请为当前页面会话保留分数,并显示 Storage is unavailable; these records will last only for this visit。 布局:使用 id='records'。在桌面端,三难度最佳表占据左侧 7/12,最近比赛列表占据右侧 5/12,顶部边缘对齐,间距为 24px。使用紧凑的等宽行,而不是单独的浮动卡片。在移动端,堆叠两者,并且仅在需要时让行内部滚动;无页面级水平溢出。Clear history 位于最近列表下方,并使用珊瑚色轮廓,而不是主导按钮。 动效:新记录获得一次 400ms 金色背景淡入。列表更新立即生效并尊重减少动态效果;不要为旧行添加动画,也不要使用会延迟实际结果的数字递增。 4. **如何比赛和计分说明** — 标题:Three steps to the finish。Step 01 是 Pick your pace — 选择 Easy、Medium 或 Hard;幽灵速度会在你开始前显示。Step 02 是 Type clean — 跟随光标,在珊瑚色错误上使用 Backspace,并将视线保持在下一个单词上。Step 03 是 Beat your record — 完成整篇文章,将结果保存在本地,并如果你想分享,下载一张卡片。 一条紧凑的计分说明写道 WPM counts every five correct characters in the matching prefix as one word。Accuracy includes printable mistakes even after you correct them。Paused time never counts。最后一行写道 [GHOST_NAME] is a fixed target pace, not a live player。 布局:使用 id='how-to-race'。将三个步骤排列为等宽列,由细的 Lane Grid 规则分隔,每个步骤都有一个大的珊瑚色步骤编号、Chakra Petch 标题和两行简洁文字。将计分说明放在下方一个全宽等宽条带中。在移动端,垂直堆叠步骤,编号在左,文案在右。 动效:不需要滚动劫持或分阶段显示。悬停时简单的 160ms 边框颜色变化就足够了。 5. **页脚** — 左侧:[BRAND] 和 [TAGLINE]。右侧:Built for local play · No account · No remote leaderboard,后跟可选的 [CREDIT] 链接。所有文本保持英文,所有依赖品牌的文案遵循变量。 布局:一条 Lane Grid 顶部边框,28px 垂直内边距,桌面端为水平 space-between 行。在移动端以 8px 间距堆叠。不要添加新闻订阅表单、社交图标或不相关的导航。 动效:无。 ## 资产 - 图像:不使用位图图像或生成资产。使用 Canvas 2D 绘制夜间赛道、两辆原创几何赛车、车道灯、方格终点线和 1200 × 630 结果卡片。将渲染代码保留在项目中,不使用下载的游戏美术资源。 - 图标:仅使用捆绑的 lucide-react 图标,用于 Play、Pause、RotateCcw、Download、Copy、Trash2、Keyboard、Flag 和 ArrowRight。方格线品牌标志为原创 CSS/SVG 几何图形,并非 Lucide 或第三方标志。 - 字体:通过 @fontsource/chakra-petch 自托管 Chakra Petch 500/600/700,通过 @fontsource/ibm-plex-mono 自托管 IBM Plex Mono 400/500/600,两者均为 OFL-1.1。将这两个包及其许可证与 lucide-react(ISC)一并记录在 ASSETS.md 中;不包含任何第三方媒体文件。 ## 不要做 - 不要添加后端、API 路由、账户、数据库、分析、远程表单、第三方 API、全球排行榜、实时多人对战,也不要声称 [GHOST_NAME] 是真实的在线玩家。 - 不要使用从现有打字游戏或竞速系列中复制的名称、标志、口号、吉祥物、布局、段落、代码、图标、声音、音轨或界面元素。 - 不要使用真实车辆品牌、可识别的量产车设计、赞助商标记、授权角色、真实人物肖像、照片、图库图片、占位服务或下载的游戏精灵图。 - 不要从 CDN 或外部 URL 加载字体、脚本、样式、图标或媒体。将列出的包本地打包,绝不在运行时请求 Google Fonts。 - 不要添加超出所列技术栈的依赖、商业字体、受限组件源码,或具有非商业、相同方式共享、不明确或缺失许可证的资产。 - 不要伪造个人最佳成绩、最近记录、准确率、WPM、在线活动或分享成功。每一项统计数据都必须来自当前运行或有效的本地历史记录。 - 不要让粘贴、自动更正、隐藏标签页时间、暂停时间或动画计时扭曲分数。不要阻止浏览器快捷键,也不要让移动用户在不自定义的非原生键盘上打字。 - 不要用宣传性主视觉、纯排版平面场景、通用便当盒式落地页或一系列营销卡片替换可玩的首屏。 - 不要使用过多的圆角卡片、玻璃拟态、无关的渐变、持续装饰性动画、滚动劫持或闪烁效果。尊重 prefers-reduced-motion。 - 不要在比赛历史或分享卡片上显示日历日期。内部排序元数据可以存储,但绝不作为前端日期显示。 - 不要生成 source map、将 src/ 复制到 dist/、超过 20 MB、使用裸目录链接或需要服务器。使用相对资产,并确保 index.html 可从静态对象存储运行。 - 不要留下失效控件、空结果、控制台错误、水平溢出、不可访问的焦点状态或低于 44px 的触摸目标。在 1440×900 和 390×844 下验证 Easy、Medium、Hard、重启、暂停/恢复、历史清除、PNG 下载和移动端打字。 --- — Prompt by VibeFather · https://vibefather.ai/t/typing-speed-race-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
个人项目可免费使用(CC BY-NC 4.0)。 商业用途需要 Pro.
DESIGN.md
单独的设计规范:配色、字体、间距和动效。可以把这套视觉用到你已有的项目上。
---
name: "Typing Speed Race Game"
colors:
night_ink: "#080B18"
track_blue: "#111A33"
electric_cyan: "#37E6F5"
signal_coral: "#FF536B"
lap_gold: "#FFC857"
pit_white: "#F4F7FF"
telemetry_gray: "#A8B3CF"
lane_grid: "#2A3858"
typography:
display_controls_and_section_titles: { family: "Chakra Petch", weights: [500, 600, 700] }
typing_passage_timers_statistics_and_data_labels: { family: "IBM Plex Mono", weights: [400, 500, 600] }
spacing: "Use an 8px base unit. The desktop content maximum is 1440px with 32px side gutters and 24px panel gaps; mobile gutters are 16px with 12px gaps. Keep the header 64px high on desktop and 56px on mobile. Cockpit panels use 24px desktop padding and 16px mobile padding. Lower sections have 64px desktop and 40px mobile vertical spacing."
radius: "Use clipped 14px corners on the two main cockpit panels, 6px on buttons and difficulty tabs, and 2px on stat cells. Use fully rounded shapes only for tiny live-status dots and the current-position marker, not for generic floating cards."
---
# Typing Speed Race Game — Design System
Apply this design system to an existing project. It describes the look and feel only; for the full site, use prompt.md.
## Colors
- **Night Ink** `#080B18` — Page background and deepest track areas.
- **Track Blue** `#111A33` — Console and canvas panel surfaces.
- **Electric Cyan** `#37E6F5` — Player car, correct characters, primary controls, and live race position.
- **Signal Coral** `#FF536B` — Error characters, countdown lights, curb stripes, and the strong secondary hero color.
- **Lap Gold** `#FFC857` — Ghost car, personal-best marks, and finish-line accents.
- **Pit White** `#F4F7FF` — Headings and primary body copy.
- **Telemetry Gray** `#A8B3CF` — Secondary copy and upcoming characters; maintain AA contrast on Night Ink and Track Blue.
- **Lane Grid** `#2A3858` — Borders, lane marks, table rules, and inactive control outlines.
## Typography
- **Display, controls, and section titles** — Chakra Petch (OFL), weights 500/600/700. Self-host the font files.
- **Typing passage, timers, statistics, and data labels** — IBM Plex Mono (OFL), weights 400/500/600. Self-host the font files.
## Spacing & shape
- Spacing: Use an 8px base unit. The desktop content maximum is 1440px with 32px side gutters and 24px panel gaps; mobile gutters are 16px with 12px gaps. Keep the header 64px high on desktop and 56px on mobile. Cockpit panels use 24px desktop padding and 16px mobile padding. Lower sections have 64px desktop and 40px mobile vertical spacing.
- Radius: Use clipped 14px corners on the two main cockpit panels, 6px on buttons and difficulty tabs, and 2px on stat cells. Use fully rounded shapes only for tiny live-status dots and the current-position marker, not for generic floating cards.
## Motion
- On Start race, show a centered 3, 2, 1, GO sequence at 650ms per step with a 160ms opacity and scale transition; input remains disabled until GO.
- Move cars strictly from race progress. Smooth visual interpolation may take 100ms, but it must never change the underlying progress or result. The ghost is calculated from active elapsed time, not random animation.
- Pulse the current-character caret every 800ms and give a newly incorrect character one 120ms horizontal nudge. Never shake the whole console.
- Reveal the inline results panel with a 220ms opacity and 12px vertical transition, then move focus to its heading. Do not use an unsolicited modal.
- With prefers-reduced-motion, remove countdown scaling, caret pulsing, nudges, smooth scrolling, and interpolation. Update essential car positions without decorative tweening and show all state changes immediately.
## Imagery
All visuals are original and drawn in code. The hero canvas shows a top-down two-lane straight circuit at night, cyan and coral curb lights, a checkered finish stripe, and two unbranded geometric cars made from simple trapezoids, rectangles, and small circular wheels. Use layered lane markers and tiny pit-light details to make the scene rich at first glance. The player's car is Electric Cyan and the ghost is Lap Gold. Do not use photographs, vehicle-brand silhouettes, mascots, people, generated images, or downloaded game art.
## Tone
Focused, energetic, and precise, like a friendly race-control console. Use short motorsport language without aggression, branded sponsorship, fake online competition, or exaggerated claims.
---
— Prompt by VibeFather · https://vibefather.ai/t/typing-speed-race-game · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
改成你自己的
- 编程训练营:将 BRAND 设置为学员批次名称,使用代码相关散文的 PASSAGE_PACK,并将 GHOST_NAME 重命名为学生应达到的目标配速。
- 小学打字俱乐部:将 BRAND 和 TAGLINE 指向俱乐部,保持简单和中等段落简单,并将幽灵标记为班级目标而非对手。
- 开发者社区页面:将其品牌化为键盘休息挑战,围绕你的聚会主题编写 PASSAGE_PACK,并在聊天中分享可下载的结果卡片。
- 个人练习页面:将 BRAND 设置为你自己的名字,选择你喜欢阅读的段落主题,并将本地个人最佳表视为你自己的记录板。
打字竞速游戏:常见问题
如何更改打字竞速游戏中的打字段落和难度?
打字竞速游戏将全部六个段落存储在段落包变量中,每个难度级别两个,因此替换该内容会改变写作主题,同时保持游戏结构不变。简单模式使用日常词汇,中等模式加入从句和逗号,困难模式包含数字、标点和符号。简单、中等和困难模式的幽灵速度分别固定为 30、45 和 60 WPM。
怎么用 AI 做一个打字竞速游戏?
复制本页的提示词,或者运行 npx vibefather add typing-speed-race-game,把 [BRAND]、[TAGLINE]、[GHOST_NAME]、[PASSAGE_PACK] 换成你自己的内容,再粘贴到 Claude Code、Codex、Cursor 等 AI 编程工具里。在线演示就是用这份提示词原样做出来的。