用这个模板做的 2 个案例
同一份提示词,不同的 [VARIABLES] 变量。点一个在上方预览。关于这个模板
这个交互式物理玩具把一个简单的旋转六边形变成了一片小巧多彩的游乐场。二十颗带编号的光泽小球在一个移动的边界内翻滚、碰撞、旋转。重力、摩擦力、旋转和球数都能在场景运行时实时调整,让访客直观看到每项设置如何改变运动。一个「摇一摇」按钮能注入新的能量,慢动作则让细小的接触更容易看清。
视觉方向刻意做得大胆。深靛蓝衬托着大块亮粉和橘色形状,青色边框勾勒出场地,青柠色让调节面板在画面中有清晰的位置。小球沿用五种高饱和糖果色,编号圆盘清晰可读,小高光直接画在 canvas 里。碰撞彩纸屑保持细小而短暂。圆润的展示字体让页面带着俏皮的语气,而普通的 HTML 控件保证它用键盘或手机都能操作。
这个布局适合创意工作室的休息区、浏览器玩具合集、交互式作品集实验,或者教育者的力学工作坊。桌面端访客会看到场地和它的控件并排。在窄屏上,场地排在最前,调节面板在下方展开。开启减少动态效果的访客会先看到一个静止场景,由自己决定何时开始。
提示词不只定义了移动墙壁和球体接触的外观,还定义了它们的计算方式。它还规定了稳定的时间步长、可见的球体旋转、响应式绘制和可用的预设方案。改掉虚构的项目名、受众、标题和实验主题,就能让同一套设计拥有新的用途。备选案例用课堂语言探索力学,展示这套俏皮的视觉系统如何在不改变色彩识别和底层物理的前提下承载另一个故事。
模板提示词
在线演示就是用这份提示词原样做出来的,没有额外补充。其他案例只是改了 [VARIABLES] 变量的值。 提示词保持英文原版,国内常用的 AI 编程工具都能直接理解;下面附中文参考译文。
# Spinning Hexagon Physics Toy Build this website exactly as described below. Replace the [VARIABLES] with your own values; keep everything else. ## Brief Build [BRAND], an original single-page physics playground called [TOY_NAME]. Twenty glossy numbered balls in hot pink, tangerine, lime, cyan and violet move inside a real rotating hexagon on mandatory deep indigo #1B1464. The first screen is the live toy, a concise invitation and a compact tuning lab, with every contact, ball spin and control implemented rather than staged. - Audience: [AUDIENCE]. The default project gives visitors a short creative break through [EXPERIMENT_THEME]; the alternate case may change that context while using the same physical toy. - Goal: Make the initial simulation immediately compelling, then let a visitor change gravity, friction, signed wall rotation, ball count, shake and simulation speed to discover different behavior. Preserve the exact palette, geometry, control meanings, fixed stack and arena-first composition when variables change. - Tone: Tactile, bright, curious and concise. Write friendly US English with concrete action labels. No pseudo-scientific claims, onboarding wall or marketing filler. Default copy appears below; adapt every context-dependent sentence to supplied variable values and keep all content in src/content.ts. ## Stack - Framework: Vite + TypeScript - Styling: Vanilla CSS - Libraries: vite (MIT), typescript (Apache-2.0), @fontsource/fredoka (OFL-1.1), @fontsource/dm-sans (OFL-1.1) - Build: `npm run build` → static files in `dist/`. No backend, no server code, no external APIs. - Setup: - Create a small vanilla TypeScript application using Vite, with index.html, src/main.ts, src/physics.ts, src/draw.ts, src/content.ts and src/styles.css; do not add React or a component framework. - Configure Vite with base: ./, build.outDir: dist and build.sourcemap: false. Set package.json build to tsc --noEmit && vite build so npm run build is the single production command. - Keep every English string, variable value, preset label, helper, status message, accessible label and keyboard-help sentence in src/content.ts. Physics and rendering read this content instead of embedding default-brand names. - Import only the needed Latin font CSS locally from @fontsource/fredoka at weights 500 and 600 and @fontsource/dm-sans at weights 400, 500 and 700. Vite must bundle the woff2 files with relative URLs. - Use CanvasRenderingContext2D for the arena, balls, number badges, original reflections and contact confetti; use ordinary HTML buttons, range inputs and output elements for every control. - Implement the solver directly in src/physics.ts using vector math and impulses. No physics engine, graphics engine, worker service, external API, audio library or runtime icon package is necessary. - Set an ordinary document title to [BRAND] and draw a tiny original six-sided favicon as a local SVG. The first page is ./index.html and must work from any static subdirectory. - Create ASSETS.md listing local font files, their Fontsource package source, their original font authors and OFL-1.1 licenses, plus the original code-drawn arena, icons and favicon. No image generation or third-party artwork is needed. ## Variables - [BRAND] — Project name (default: "Bounce Break"). An invented name for the project; use it in the header, footer, document title and content configuration. - [TOY_NAME] — Playground name (default: "Candy Collision Club"). A short name for this specific playground. It appears above the arena and in the accessible scene description. - [HEADLINE] — Main headline (default: "Give chaos a little spin."). A short invitation of four to eight words; preserve the compact two-line headline layout. - [AUDIENCE] — Who plays here (default: "curious minds taking a two-minute creative break"). A plain audience description used to rewrite the introduction and experiment descriptions. - [EXPERIMENT_THEME] — Experiment theme (default: "candy collisions and joyful little surprises"). A subject for all supporting copy and preset explanations. It changes the story, not the fixed arena geometry, numerical physics settings or neon palette. - [CREDIT] — keep a small "Template by VibeFather" link to https://vibefather.ai/t/spinning-hexagon-physics-toy 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 - Deep indigo `#1B1464` — Mandatory dominant page background, header, footer and right-hand control-card body; never replace with black or a muted neutral. It remains visible around every section. - Arena indigo `#241B7A` — Arena panel backing and control disclosure backing, distinct from the deep indigo page. - Inner ink `#130D3F` — Hexagon interior, dark text on all five bright colors, ball number glyphs, slider outlines and solid control-card borders. - Hot pink `#FF3DA4` — Large clipped upper-left circle behind the arena, one fifth of the balls, selected experiment tab, and the full-width Shake it up button. Pink covers an actual hero surface, not only a small accent. - Tangerine `#FF8A34` — Large lower-right arena semicircle, one fifth of the balls, gravity-slider fill and action-button pressed state. - Lime `#C7F43F` — Solid 76px-high Tuning lab card header, one fifth of the balls, active slow-motion pill and friction-slider fill. Dark ink text only. - Cyan `#25E5F2` — Broad luminous hexagon edge, one fifth of the balls, spin-slider fill, keyboard focus rings and active status dot. - Violet `#A56BFF` — One fifth of the balls, count-slider fill and the How it moves disclosure label background; use dark ink labels on violet. - Paper white `#FFFFFF` — Main headings, control labels, readable value outputs, ball-number badge discs and small glossy reflections. - Lilac text `#DCD6FF` — Secondary body text on the indigo backgrounds; use solid color rather than low-opacity white. ### Typography - Wordmark, main headline, arena title and large control headings: Fredoka (OFL), weights 500/600 - Body, labels, helper text, statuses and numeric outputs: DM Sans (OFL), weights 400/500/700 ### Layout & motion - Spacing: Use a 4px base grid. Desktop shell max-width 1280px with 32px side padding, 24px workspace gap, 20px card interiors, 16px control gaps and 24px before the explanation/footer band. Header 64px; mobile shell 16px, header 56px, card interiors 16px and gaps 16px. Keep the desktop workbench visible within the 1440x900 first screen and the mobile headline, whole arena and transport visible within 390x844. Avoid giant empty spacer sections. - Radius: Arena 28px, tuning card 24px, ordinary buttons 14px, preset rows 10px, pills fully rounded. Use solid 2px dark ink outlines and a crisp 8px downward dark ink shadow to give the toy a physical, chunky edge; do not use a glass-dashboard card system. - Motion: Use requestAnimationFrame rendering with a 1/240-second physics accumulator and adaptive collision microsteps, independent of frame rate. The detailed numerical solver in Interactive candy arena is part of the implementation requirement. - Motion: Ball numbers and seams rotate with their computed angular state; wall rotation, contact impulses and friction are physical. Keep the five-color gloss legible throughout motion. - Motion: Energetic contact confetti has a per-contact cooldown, lifetime below 0.4 second and maximum 120 particles. No strobe, full-screen flash, page shake, parallax, autoplay audio or ornamental reveal choreography. - Motion: Respect prefers-reduced-motion by initially pausing in a polished still state, exposing Start motion and disabling confetti/decorative transitions. Ordinary users start automatically. Pause and Resume always remain available. - Motion: Buttons have only a 100-120ms color/press response. Native details open immediately. No smooth scroll or press displacement with reduced motion. - Imagery: Everything is drawn in code: glossy spheres, physical arena, two saturated backing shapes, tiny confetti, original hexagon mark, favicon and simple control symbols. There are no photographs, portraits, bitmaps, imported illustrations, 3D models or generated images. The arena itself is the large high-craft visual anchor; it must show twenty numbered balls clearly on load, not an empty container or static placeholder. ## Pages & Sections ### [BRAND] - [TOY_NAME] (`index.html`) 1. **Header and invitation** — Header left: an original outlined hexagon mark with three candy-colored dots and the [BRAND] wordmark. Header right: the quiet label A pocket-sized physics playground and a How it moves button that opens the explanatory disclosure below the workspace and scrolls it into view. The visible introduction has eyebrow SPIN / BOUNCE / REPEAT, headline [HEADLINE] (default Give chaos a little spin.), and body A candy-colored playground for curious minds taking a two-minute creative break. Twenty little balls. One spinning world. The body must be rewritten from [AUDIENCE] and [EXPERIMENT_THEME] when variables change. The right edge of the intro shows an original five-dot candy swatch and the small label No score. Just play. Do not repeat the template title as the brand. Layout: Page background is solid #1B1464. Center a 1280px maximum shell with 32px horizontal padding at 1440px width. Header is 64px tall with white Fredoka wordmark at 24px, cyan outline icon and lilac secondary copy. Intro begins 18px below it; headline is Fredoka 600 at 56px/1.02, maximum 640px, white except the final meaningful word rendered solid #C7F43F. Keep the colored word from [HEADLINE] dynamically rather than hard-coding spin. Body is DM Sans 400 at 16px/1.5, #DCD6FF, maximum 590px. On mobile use 16px shell padding, a 56px header, 21px wordmark, hide the purely decorative header tagline, use a visible 44px How it moves icon/text button and a 36px/1.03 headline. The intro and actual arena must both appear within the first 390x844 viewport. Motion: Only button affordances transition over 120ms. No intro fly-in, delayed text reveal, automatic marquee or parallax. 2. **Interactive candy arena** — Arena top strip: [TOY_NAME] on the left, then a cyan dot plus Live, Paused or Reduced motion on the right. The scene is a genuine live Canvas 2D simulation, described by an accessible caption: Twenty glossy numbered balls bounce inside a rotating hexagon. Change the controls to explore candy collisions and joyful little surprises. Rewrite the theme phrase from [EXPERIMENT_THEME]. Draw all twenty numbers, five glossy candy colors and the spinning rim clearly. Put the primary action bar directly under the canvas; exact labels and behavior are defined in Tuning lab and transport. Keep a visually hidden text summary of running state, actual count, spin direction and time factor synchronized without announcing every frame. Implement genuine two-dimensional rigid-disk motion, not a looping animation. Keep the physics in a square world with x rightward, y downward, width and height 1000 world units, arena center C=(500,500), regular-hexagon circumradius 420, equal ball radius r=27, mass m=1 and disk inertia I=0.5*m*r*r. Use the same logical world on every screen; resize only the drawing transform. Default to 20 balls labeled 1 through 20, cycling pink, tangerine, lime, cyan and violet so each color appears four times. Each ball has x/y position, x/y velocity, angular position and angular velocity. The rendered number and a small curved seam rotate with that ball's angular position; the reflection can remain light-fixed. Seed a deterministic PRNG with 137 and place the initial balls in a staggered five-column, four-row cluster near the upper center, with 61-unit center spacing, small nonoverlapping jitter and small varied initial velocities. Check every initial disk against the polygon and the other disks; rejected samples must be retried. The initial hexagon angle is -PI/6 and its default signed angular velocity is +30 degrees per second, meaning clockwise in the canvas coordinates. The initial cluster begins falling on the first rendered frame when ordinary motion is allowed. Run requestAnimationFrame for rendering and a time accumulator for physics with a base step of 1/240 second. Clamp real frame delta to 0.05 second, limit catch-up to 12 base steps and discard excess lag when the tab resumes instead of advancing a large unsafe jump. Apply slow motion by adding delta*0.25 to the accumulator, never by reducing collision quality. At each base step, subdivide further until the maximum anticipated relative translation of any ball and wall is at most 0.35*r; include max ball speed, abs(arena angular velocity)*420 and gravity in that estimate. Use at most 16 microsteps, with the specified velocity limit below ensuring that this bound remains reachable. Save prior and current positions/angles for smooth rendering interpolation. Pausing freezes balls, wall angle and contact particles; changes to coefficients can still be made while paused. Reset the accumulator whenever pause state or document visibility changes, and suspend updates while the document is hidden. For every microstep, advance the arena angle by omega*h, compute its six vertices a_i=C+420*(cos(theta+i*PI/3),sin(theta+i*PI/3)), integrate gravity g=(0,900*gravityMultiplier) with semi-implicit Euler, apply exponential air damping exp(-0.10*h) to linear velocity and exp(-0.16*h) to angular velocity, and integrate ball orientation. Use a defensive linear speed cap of 1800 world units/second and angular speed cap of 24 radians/second; these are numerical safeguards, not a substitute for correct collisions. Keep finite-value guards so a malformed state cannot poison the entire canvas. Solve every unique ball pair and every ball against all six wall half-planes in 8 sequential contact iterations per microstep. For directed edge a to b in this vertex order, e=b-a and the inward unit normal is n=(-e.y,e.x)/length(e). Signed disk-center distance is d=dot(p-a,n). A disk needs d>=r. If d<r, move its center inward by the penetration plus a tiny 0.01-unit margin. Use the nearest point q=p-d*n on the boundary line for the wall's contact velocity, vw=(-omega*(q.y-C.y),omega*(q.x-C.x)), with omega in radians/second. The disk's wall-facing contact offset is rb=-r*n; its contact velocity is v+(-ballOmega*rb.y,ballOmega*rb.x). Compute relative velocity against vw, so a moving wall genuinely gives or takes energy. If vn=dot(relative,n)<0, apply normal impulse jn=-(1+restitution)*vn*m, with wall restitution 0.76 for energetic impacts and restitution 0 when abs(vn)<35, eliminating tiny perpetual bounces. Resolve tangential friction using a tangent t=(-n.y,n.x): jt=-dot(relative,t)/(1/m+cross(rb,t)^2/I), clamped to plus or minus friction*abs(jn). Apply linear impulse (jn*n+jt*t)/m and spin impulse cross(rb,jt*t)/I. Recompute relative contact velocity after the normal impulse. For resting wall contacts, allow the friction limit to use max(abs(jn),m*max(0,-dot(g,n))*h) so the rotating wall still drags a low-speed disk. Restrict confetti to genuinely new, energetic impacts rather than every solver iteration. For disk pairs, n points from A to B, penetration=2*r-distance. Split positional correction equally, retaining no more than a 0.02-unit contact slop; handle coincident centers using a deterministic nonzero normal. Contact offsets are +r*n on A and -r*n on B. Compute the two contact-point velocities including angular terms. Let relative=contactVelocityB-contactVelocityA; when dot(relative,n)<0 apply the equal-and-opposite normal impulse with inverse-mass sum 2/m and pair restitution 0.80 above the same 35-unit threshold, otherwise 0. Recompute tangential velocity and clamp the tangential impulse to friction times the normal impulse using denominator 2/m+cross(rA,t)^2/I+cross(rB,t)^2/I. Apply equal-and-opposite linear and angular impulses with consistent signs. This must transfer visible spin during glancing contact. When separating a pair, do not apply a new attractive normal impulse. Recheck all wall half-planes after pair correction and finish each microstep with a final inward projection pass, including corners; the visible rim and the physical boundary must be identical. Do not periodically teleport balls back to the center as an escape fix. Wall and pair contacts whose incoming normal speed exceeds 170 world units/second may emit 3 tiny rectangles in the five palette colors. Store an independent 0.10-second cooldown per contact key, with at most 120 particles alive; each lives 0.18-0.38 second, moves with its own short ballistic arc and fades smoothly. The confetti is an additive garnish at the actual contact point, never a full-screen burst. Report live ball count, rotation direction and simulation speed from actual state; do not invent FPS, energy or scientific measurements. Layout: At widths 1100px and above, the workspace is a two-column grid with a flexible arena column and a 328px tuning column, gap 24px; align their tops and make the arena card 592px high. The arena uses #241B7A, a solid 2px #130D3F outline, 28px corners and a crisp 8px lower shadow in #130D3F. A 220px solid #FF3DA4 circle clipped into the upper-left backing and a 260px solid #FF8A34 semicircle clipped into the lower-right backing are large visible surfaces outside the physical hexagon; they never cover the rim, balls, copy or controls. The actual hexagon fills #130D3F at full opacity, with an 8-world-unit #25E5F2 rim, restrained 12-unit cyan glow and a fine white inset edge. Avoid transparency that weakens the colors. The 40px top strip uses white/lilac text, and a 64px action bar sits below the canvas. The canvas fills the remaining height and its drawing transform uses scale=min(cssWidth,cssHeight)/1000 with centered world coordinates, leaving at least 6% padding beyond the rotating circumcircle. Cap devicePixelRatio at 2 and reset the canvas transform after each size change. Ball base colors cycle through the five exact hues; add a darker lower crescent and small white specular ellipse, then a white central number disc with #130D3F Fredoka 600 numerals at 30 world units. All ball surfaces and number discs rotate together except the light-fixed highlights. Use a soft small contact shadow instead of blur over the numbers. On 760-1099px use a flexible arena and 300px control panel, with minimum stage height 530px. At 759px and below stack the cards; arena card is approximately 424px high at 390px width, with 32px top strip, 326px canvas area and 64px action bar. The scene must stay fully visible without clipping any hex vertex at every rotation angle. The mobile render keeps the same world physics, radius and palette rather than using a smaller physical arena. Motion: The physical wall and number seams rotate at their actual solved angles. Keep continuous rendering smooth, with no CSS oscillation substituting for simulation. Confetti appears only on energetic contacts, with a 120-particle ceiling and smooth fade. The page and canvas backing never shake or flash. Under prefers-reduced-motion, render a polished still arrangement on load, set status Reduced motion, disable confetti and decorative motion, and show an explicit Start motion button; only an intentional click starts physics. After that click keep reduced-motion confetti disabled. The user can Pause at any moment. 3. **Tuning lab and transport** — The side panel is titled Tuning lab and has helper copy Make a tiny change. Watch a different world. Use four labeled native range controls with persistent associated output values: Gravity is 0.00x-2.00x in steps of 0.05x, default 1.00x, multiplied by 900 world units/second squared; its helper is Pull toward the floor. Friction is 0.00-0.80 in steps of 0.01, default 0.18, used as the Coulomb coefficient at wall and pair contacts; helper Slippery to grippy. Spin is -120 to +120 degrees/second in steps of 5, default +30; display 30 degrees/s clockwise, 0 degrees/s stopped or the corresponding counterclockwise value. Balls is an integer 4-40, default 20; helper More company, more collisions. Use a compact minus button and plus button beside the count value as well as the range input; clamp both buttons at the same limits. Gravity, friction and spin changes apply on the next physics microstep without reinitializing ball positions. At zero gravity, moving balls continue with air damping; do not silently re-enable gravity. At zero spin the physical wall stops but balls continue. At friction zero remove contact friction rather than silently retaining it. Changing the count preserves existing low-numbered balls: remove highest IDs first; add new IDs using up to 250 nonoverlapping sample attempts inside the polygon, with at least 2 units between disks. If necessary spread remaining spawn attempts across the full safely inset arena over later microsteps. Never spawn overlapping disks, place them outside the wall or silently report a requested count that has not yet appeared; show Adding balls while queued spawns remain and then the real total. The accessible count status updates only on a completed count change. Reset clears any pending spawns. Under the ranges, show three experiment chips, Candy tumble, Float party and Sticky spiral. Candy tumble sets gravity 1.00x, friction 0.18, spin +30 degrees/s and 20 balls; Float party sets 0.20x, 0.06, +45 and 20; Sticky spiral sets 0.70x, 0.55, -55 and 28. Selecting a chip changes those parameters and the count without resetting existing bodies. Highlight a chip only when every current setting equals that preset. Small preset descriptions for the default theme are A cheerful pile-up, Light on their feet and Take the scenic route. Rewrite these names and descriptions for a different [EXPERIMENT_THEME] while preserving these numerical recipes. A Reset toy text button below the chips restores the default numerical recipe, the initial hex angle, deterministic 20-ball cluster, normal speed and empty confetti. Preserve the user's paused/running state and never override a reduced-motion pause. A selected-preset change never silently exits slow motion. The arena action bar contains Pause, Shake it up and Slow motion. Pause toggles to Resume with an appropriate pressed state. Shake it up gives each existing ball an independently seeded upward impulse of 350-750 units/second, a horizontal impulse of -500 to +500 and angular impulse of -8 to +8 radians/second, clamps to the safety speed limits, and announces Shake added. It does not reset the arena or ball count. If paused, the impulse is stored and takes effect on Resume; the status says Shake ready - resume to release. Slow motion is a toggle between 1.00x and 0.25x simulation time and is labeled Slow motion on when active. An adjacent compact indicator reads 1x time or 0.25x time. No sound is necessary. Include a native details disclosure Keyboard shortcuts with Space: pause or resume, S: shake, M: slow motion, R: reset. Shortcut handlers ignore editable controls, range inputs, contenteditable elements and modified key combinations; focused native inputs keep their browser keyboard behavior. All actions also work with click or tap. Layout: Tuning card is 328px wide and 592px tall on desktop, with 24px corners, 2px #130D3F border and the same 8px lower shadow. Its solid #C7F43F header is 76px high, with dark ink Fredoka 600 title at 24px and dark ink helper at 12px. The body is #1B1464 with 20px padding. Place the four controls vertically with 16px gaps; each uses a white 14px bold label left and a tabular white numeric output right, a 6px track inside a 44px-tall input target, a 20px solid bright thumb with dark outline, and #DCD6FF helper at 12px. Use tangerine, lime, cyan and violet fills for gravity, friction, spin and count respectively. Never use low-opacity neon for body text. Presets are three compact stacked rows with 36px minimum visible height and 44px target height; selected row is solid hot pink with dark ink text and a check icon; other rows have a thin cyan outline and white labels. Reset is a 44px text-button row. Arena action bar has three controls: Pause as a 44px white-outlined indigo button, Shake it up as the visually largest 44px hot-pink button with dark text, and Slow motion as a 44px indigo pill that turns solid lime with dark text when selected. On mobile use 12px horizontal stage padding, 8px gaps and short visible labels Pause, Shake and Slow 0.25x while retaining the complete accessible names. All three fit the 358px arena width without overflow. At 759px and below the tuning card is full width beneath the arena; use an accessible disclosure summary Tuning lab with the current count and gravity at the right, collapsed initially. Expanding it reveals all controls in normal document flow with no modal or fixed overlay; its header stays solid lime. Desktop shows the tuning body expanded and no disclosure affordance. Motion: Slider changes immediately update outputs and the live physics. Native range controls remain keyboard accessible. Buttons use a 2px press translation for 100ms and a visible 3px cyan focus ring with a 3px gap; omit translation for reduced motion. Announce only discrete count, reset, shake and pause events in a polite live region. Avoid frame-by-frame live announcements. 4. **How it moves and footer** — Below the workspace, include a native details block with summary How it moves and the one-line teaser Small rules. Delightful results. Its three concise rows read: Gravity pulls every ball down. Turn it off to watch the wall do the work. / Friction trades sliding for spinning. Look closely: the numbers turn with each ball. / The wall is moving too. A fast edge can give a ball an extra kick. Under those rows use the statement This is a playful model, not a measurement tool. For an educational [EXPERIMENT_THEME], rewrite the teaser and supporting rows around the supplied topic while keeping these physical facts correct. Include the Keyboard shortcuts details block specified above. Footer left: [BRAND]. Footer right: Made for a tiny break. Rewrite that line to match [AUDIENCE] for the alternate topic. A small optional [CREDIT] link can follow the footer when supplied by the surrounding prompt; there is no date, copyright year, external social-link set, registration or newsletter form. Layout: Use an uncluttered single horizontal band 24px below the workspace with a thin cyan top border, not a large tutorial section. The How it moves summary is a violet #A56BFF capsule with #130D3F text and an original plus/minus icon; the teaser and expanded explanation text use white and #DCD6FF on #1B1464. Expanded details has a three-column grid of short text at desktop and stacked rows at mobile, with 20px inner gaps and 14px/1.5 DM Sans. Footer is 48px tall with 13px lilac text, left/right aligned at desktop and a two-line flex wrap at mobile. The expanded details grows the page naturally; nothing is hidden behind sticky UI. Motion: Details open immediately without a height animation. The header How it moves button sets this details element open, moves keyboard focus to its summary and scrolls it into view using smooth scrolling only when reduced motion is off. ## Assets - font: Install @fontsource/fredoka locally and import its Latin 500.css and 600.css files; install @fontsource/dm-sans locally and import Latin 400.css, 500.css and 700.css. Bundle only the used woff2 files in dist/ with relative asset paths. Package sources are https://www.npmjs.com/package/@fontsource/fredoka and https://www.npmjs.com/package/@fontsource/dm-sans. Fredoka is by Milena Brandao and DM Sans is by Colophon Foundry, both OFL-1.1. Record actual local paths, original authors, package source URLs and license files in ASSETS.md. Do not use Google Fonts or another remote stylesheet. - icon: Author minimal inline SVG icons locally for play, pause, shake, reset, plus, minus, check and the six-sided project mark. Use a 24x24 viewBox, rounded 2px strokes and currentColor. Draw a local SVG hexagon favicon at public/favicon.svg. These are original geometric symbols, not copied logo assets. Mark them as locally authored in ASSETS.md. - image: Generate the arena, glossy balls, white number discs, color backing shapes and tiny contact confetti at runtime in Canvas 2D using the precise palette and geometry above. No downloaded or generated image files are used, so no image URLs or images.json are needed. The canvas needs its descriptive accessible caption in the page. ## Don'ts - Do not replace the fixed Vite + vanilla TypeScript + Canvas 2D + vanilla CSS stack with React, a graphics engine, a physics engine or a hosted service. Use npm run build and output only static production files in dist/. - Do not add a backend, server code, API routes, database, authentication, external forms, payments, analytics, telemetry or third-party APIs. All controls operate entirely in memory in the browser. - Do not use absolute root asset URLs or directory-only internal links. Set Vite base to ./; every internal page link must include ./index.html or another real HTML filename, or a #/ hash route. This toy has one index.html page. - Do not ship unminified production code, source maps, source source files or src/ inside dist/. Keep the entire dist/ under 20 MB and make it load from an arbitrary static subdirectory. - Do not load fonts, scripts, styles, images, sounds or icons from CDNs or remote hosts. Self-host only the specified OFL fonts from Fontsource, bundling their woff2 files and licenses locally. - Do not add npm dependencies outside permissive MIT, ISC, BSD-2-Clause, BSD-3-Clause, Apache-2.0, 0BSD, CC0-1.0, Unlicense or OFL-1.1 for fonts. No restricted UI source, purchased templates, unlicensed code, CC BY-NC or CC BY-SA assets. - Do not reuse a source-site product name, slogan, wordmark, prompt text, implementation, copy, control composition, screenshot, video, custom typeface or distinctive icon. The arena, art, favicon and interface must be independently authored. - Do not include real brand logos, recognizable products, real people, recognizable characters, stock photography, remote placeholders, third-party artwork or a 3D engine. This code-drawn toy needs no image-generation step and no images.json. - Do not leave any third-party font file undocumented. ASSETS.md must list its local path, package source, font author and OFL-1.1 license; mark the original canvas and SVG work as locally authored. - Do not turn the neon-pop palette into cream, white, gray, black, pastel or low-saturation surfaces. Preserve #1B1464 as the page background and retain #FF3DA4, #FF8A34, #C7F43F, #25E5F2 and #A56BFF in both cases. Hot pink and tangerine must occupy the large arena backing shapes; lime must occupy the tuning header; cyan must outline the physical arena. Strong colors cannot be confined to small buttons. - Do not use bright colors with white body text, low-opacity body text or a faint disabled/focus state that cannot be read. Use #130D3F text on bright surfaces and white/#DCD6FF on indigo; maintain WCAG AA for normal text and visible focus for every interactive element. - Do not omit the live arena from the first mobile viewport, hide it behind typography, obscure it with controls, crop a vertex during rotation or let the page overflow horizontally. Verify the full default layout at 1440x900 and 390x844 with zero console errors. - Do not use a pre-recorded animation, CSS keyframes, per-frame random displacement or a library as the ball physics. Implement all wall/ball and ball/ball impulses, angular effects, friction, gravity, damping and positional correction directly. - Do not let the rendered hexagon and solver boundary differ. Use the same six world-space vertices, center and angle; use the moving wall contact velocity omega cross (q-C), including sign and radians, for every wall impulse. - Do not drop or fake the 20 numbered default balls. All integers 1 through 20 must appear once initially, with the five candy colors evenly repeated, glossy shading and real number/seam rotation. Count changes must show exactly the real current count and preserve lower IDs. - Do not allow balls to escape, tunnel through corners, overlap persistently, sink into a settled pile, acquire NaN state or gain endless resting jitter. Use the fixed time accumulator, adaptive collision microsteps, 8 contact iterations, low-speed restitution threshold, pair correction and final inward wall projection described above. No periodic respawn or center-teleport escape fix. - Do not advance physics by an unbounded frame delta, lose stability at the maximum signed spin, use slow motion to reduce solver iterations, or run catch-up after a hidden tab returns. Preserve the specified 1/240-second base step, relative-translation microstep bound, safety speed caps and accumulator resets. - Do not confuse angular speed units or friction signs. Arena controls are degrees per second; solver angular values are radians per second. Contact velocity must include ball angular velocity. Pair impulses must be equal and opposite, and friction must oppose tangential slip. - Do not apply a collision normal impulse to already separating bodies, use friction zero as a visual-only change, silently re-enable zero gravity, or keep rotating the physical boundary at zero spin. All parameter settings must have real observable effects. - Do not reset or teleport the ball state when a slider, preset, slow-motion toggle or count changes. Only Reset toy reinitializes the world. Spawn new balls inside the current rotated polygon without overlap; queue an addition transparently if required. - Do not omit Gravity, Friction, Spin, Balls, Shake, Pause/Resume, Slow motion, presets or Reset toy. The exact ranges, default values and numerical recipes above are required. A selected preset remains selected only while its actual settings match. - Do not implement Shake as moving the canvas or the whole page. It adds per-ball linear and angular impulses. While paused, store the impulse, report the ready state and wait for Resume. Pause freezes the wall, balls and particles together. - Do not make tiny confetti into continuous visual noise. Emit only at newly energetic physical contacts, use per-contact cooldowns, cap at 120 active particles, respect lifetime limits and disable confetti completely for reduced motion. - Do not autoplay physics for users with prefers-reduced-motion. Start in a well-composed still state with an explicit Start motion action and Reduced motion status; only direct user intent may start it, and Pause must remain available. Omit decorative motion and smooth scrolling under that preference. - Do not rely on hover, drag, keyboard shortcuts or canvas hit targets for essential actions. Every action needs a visible semantic HTML control, associated labels, keyboard access, 44px touch targets and a clear selected/pressed state. Range inputs retain native keyboard behavior. - Do not intercept shortcuts while focus is in an editable control or a range input. Prevent Space scrolling only when the global pause shortcut actually handles the key. Do not stream physics events into a live region every frame. - Do not use a modal or fixed tuning overlay on mobile. Keep the arena-first stacked layout, working expandable lime tuning header, responsive canvas backing resolution and all controls in reachable document flow. - Do not invent FPS, energy, user-count, scientific-accuracy or popularity claims. The visible count, running state, direction and time factor must come from actual simulation state. This is a toy rather than a measurement tool. - Do not hard-code default-brand words anywhere outside src/content.ts. Apply all supplied variables to header, title, arena caption, intro, preset names/descriptions, explanatory text, footer and accessible labels; rewrite theme-dependent copy coherently while preserving the defined physics and layout. - Do not show dates, years, countdowns, release timestamps or a front-end copyright year. Keep all visible content, sample text, status labels, alt/accessibility text and variable defaults in US English. - Do not mention VibeFather in the site itself except an optional [CREDIT] footer link. Do not mention competitors, comparison claims or reference-brand names in the site or product copy. - Do not add SEO sections, meta descriptions, Open Graph tags, JSON-LD, sitemap work, a newsletter, pricing or a marketing funnel. Use only a plain [BRAND] document title and the original local favicon. - Do not leave any interaction as a dead decorative control. Before delivery run the production build, inspect the default desktop/mobile views, operate every range at both extremes, test positive/negative/zero spin, switch all presets, reach 40 balls, shake repeatedly, pause/resume, reset and use 0.25x time; watch an extended worst-case simulation to check containment and finite state. - Do not skip reduced-motion and resize verification: confirm the explicit start state, disabled confetti, preserved state through resizing, functioning mobile disclosure and absence of console errors or horizontal overflow. Fix actual defects before shipping. --- Inspired by Spinning Hexagon Physics Toy by @GlanceHall — https://glancehall.com/blog/coding-agents/codex-projects — Prompt by VibeFather · https://vibefather.ai/t/spinning-hexagon-physics-toy · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
中文参考译文(帮助理解,复制给 AI 时请用上面的英文原版)
# 旋转六边形物理玩具 完全按照以下描述构建此网站。将 [VARIABLES] 替换为你自己的值;其余内容保持不变。 ## 简介 构建 [BRAND],一个名为 [TOY_NAME] 的原创单页物理游乐场。二十个带光泽的编号球,颜色为亮粉色、橘色、青柠绿、青色和紫罗兰色,在一个真正旋转的六边形内运动,背景为强制性的深靛蓝色 #1B1464。首屏是实时玩具、一句简洁的邀请语和一个紧凑的调参实验室,每一次接触、球的旋转和控件都是真实实现的,而非预先编排。 - 受众:[AUDIENCE]。默认项目通过 [EXPERIMENT_THEME] 为访客提供短暂的创意休息;备选案例可以改变这一语境,同时使用同一个物理玩具。 - 目标:让初始模拟立即引人入胜,然后让访客改变重力、摩擦力、带符号的墙壁旋转、球的数量、摇晃和模拟速度,以发现不同的行为。当变量变化时,保持精确的调色板、几何形状、控件含义、固定技术栈和竞技场优先的构图不变。 - 语气:触感、明亮、好奇且简洁。使用友好的美式英语,配以具体的操作标签。不要伪科学式的断言、入门门槛或营销废话。默认文案见下文;根据提供的变量值调整每一句依赖语境的句子,并将所有内容保留在 src/content.ts 中。 ## 技术栈 - 框架:Vite + TypeScript - 样式:原生 CSS - 库:vite(MIT)、typescript(Apache-2.0)、@fontsource/fredoka(OFL-1.1)、@fontsource/dm-sans(OFL-1.1) - 构建:`npm run build` → `dist/` 中的静态文件。无后端、无服务器代码、无外部 API。 - 设置: - 使用 Vite 创建一个小的原生 TypeScript 应用,包含 index.html、src/main.ts、src/physics.ts、src/draw.ts、src/content.ts 和 src/styles.css;不要添加 React 或组件框架。 - 配置 Vite,设置 base: ./、build.outDir: dist 和 build.sourcemap: false。将 package.json 的 build 设置为 tsc --noEmit && vite build,使 npm run build 成为唯一的生产命令。 - 将所有英文字符串、变量值、预设标签、辅助函数、状态消息、无障碍标签和键盘帮助语句保留在 src/content.ts 中。物理和渲染读取此内容,而不是嵌入默认品牌名称。 - 仅从 @fontsource/fredoka 本地导入所需的拉丁字体 CSS,字重为 500 和 600,并从 @fontsource/dm-sans 导入字重 400、500 和 700。Vite 必须使用相对 URL 打包 woff2 文件。 - 使用 CanvasRenderingContext2D 绘制竞技场、球、数字徽章、原始反射和接触彩纸;为每个控件使用普通 HTML 按钮、范围输入和输出元素。 - 直接在 src/physics.ts 中使用向量数学和冲量实现求解器。无需物理引擎、图形引擎、worker 服务、外部 API、音频库或运行时图标包。 - 将普通文档标题设置为 [BRAND],并绘制一个小的原创六边形 favicon 作为本地 SVG。第一页是 ./index.html,必须能从任何静态子目录工作。 - 创建 ASSETS.md,列出本地字体文件、其 Fontsource 包来源、其原始字体作者和 OFL-1.1 许可证,以及原创代码绘制的竞技场、图标和 favicon。无需图像生成或第三方艺术作品。 ## 变量 - [BRAND] — 项目名称(默认:"Bounce Break")。这是为项目虚构的名称;在页眉、页脚、文档标题和内容配置中使用它。 - [TOY_NAME] — 游乐场名称(默认:"Candy Collision Club")。这是该特定游乐场的简短名称。它出现在竞技场上方以及无障碍场景描述中。 - [HEADLINE] — 主标题(默认:"Give chaos a little spin.")。一句四到八个词的简短邀请语;保持紧凑的两行标题布局。 - [AUDIENCE] — 谁来玩(默认:"curious minds taking a two-minute creative break")。一段平实的受众描述,用于改写引言和实验描述。 - [EXPERIMENT_THEME] — 实验主题(默认:"candy collisions and joyful little surprises")。所有辅助文案和预设说明的主题。它改变的是故事,而非固定的竞技场几何结构、数值物理设置或霓虹配色。 - [CREDIT] — 在页脚保留一个小型 "Template by VibeFather" 链接,指向 https://vibefather.ai/t/spinning-hexagon-physics-toy(默认:是;删除此行即可移除) 页面与区块下的文案是按默认值撰写的。如果你的取值不同,请为它们重写每一个标题、段落、标签和图片——保持相同的长度、语气和结构。布局、颜色、字体和动效保持所述不变。 将所有文案、图片路径和链接放在一个内容文件中(例如 `src/content.ts`),按区块作为键,以便日后无需改动组件即可替换内容。 ## 设计 ### 颜色(Colors) - 深靛蓝(Deep indigo)`#1B1464` — 强制性的页面主背景色、页眉、页脚和右侧控制卡片主体;绝不可替换为黑色或柔和的中性色。它在每个区块周围都保持可见。 - 竞技场靛蓝(Arena indigo)`#241B7A` — 竞技场面板底色和控制项展开区底色,与深靛蓝页面区分开。 - 内墨色(Inner ink)`#130D3F` — 六边形内部、全部五种亮色上的深色文字、球号字形、滑块轮廓和实心控制卡片边框。 - 亮粉色(Hot pink)`#FF3DA4` — 竞技场后方的大型裁切左上圆形、五分之一的球、选中的实验标签,以及全宽的 Shake it up 按钮。粉色覆盖的是实际的 hero 表面,而不仅仅是小面积点缀。 - 橘橙色(Tangerine)`#FF8A34` — 大型右下竞技场半圆、五分之一的球、重力滑块填充和操作按钮按下态。 - 青柠色(Lime)`#C7F43F` — 实心 76px 高的 Tuning lab 卡片标题栏、五分之一的球、激活的慢动作胶囊和摩擦力滑块填充。仅使用深墨色文字。 - 青色(Cyan)`#25E5F2` — 宽大的发光六边形边缘、五分之一的球、旋转滑块填充、键盘焦点环和激活状态圆点。 - 紫罗兰色(Violet)`#A56BFF` — 五分之一的球、数量滑块填充和 How it moves 展开标签的背景;在紫罗兰色上使用深墨色标签。 - 纸白色(Paper white)`#FFFFFF` — 主标题、控制标签、可读的数值输出、球号徽章圆盘和小面积光泽反射。 - 淡紫色文字(Lilac text)`#DCD6FF` — 靛蓝背景上的次级正文文字;使用实色而非低透明度白色。 ### 字体排印(Typography) - 字标、主标题、竞技场标题和大型控制标题:Fredoka(OFL),字重 500/600 - 正文、标签、辅助文字、状态和数值输出:DM Sans(OFL),字重 400/500/700 ### 布局与动效(Layout & motion) - 间距:使用 4px 基础网格。桌面外壳最大宽度 1280px,侧边内边距 32px,工作区间距 24px,卡片内部 20px,控件间距 16px,说明/页脚带之前 24px。页眉 64px;移动端外壳 16px,页眉 56px,卡片内部 16px,间距 16px。确保桌面工作台在 1440x900 首屏内可见,移动端标题、完整竞技场和传输控件在 390x844 内可见。避免巨大的空白间隔区块。 - 圆角:竞技场 28px,调校卡片 24px,普通按钮 14px,预设行 10px,胶囊完全圆角。使用实心 2px 深墨色轮廓和清晰的 8px 向下深墨色阴影,赋予玩具实体、厚实的边缘;不要使用玻璃仪表盘式卡片系统。 - 动效:使用 requestAnimationFrame 渲染,配合 1/240 秒物理累加器和自适应碰撞微步,独立于帧率。Interactive candy arena 中的详细数值求解器是实现要求的一部分。 - 动效:球号和接缝随其计算出的角状态旋转;墙壁旋转、接触冲量和摩擦力均为物理模拟。在运动过程中保持五色光泽清晰可辨。 - 动效:充满活力的接触彩纸具有每次接触冷却、生命周期低于 0.4 秒且最多 120 个粒子。无频闪、全屏闪光、页面抖动、视差、自动播放音频或装饰性揭示编排。 - 动效:遵循 prefers-reduced-motion,初始以精致的静止状态暂停,显示 Start motion 并禁用彩纸/装饰性过渡。普通用户自动开始。Pause 和 Resume 始终可用。 - 动效:按钮仅有 100-120ms 的颜色/按下响应。原生 details 立即打开。减少动效时无平滑滚动或按下位移。 - 图像:一切均以代码绘制:光泽球体、物理竞技场、两个饱和底色形状、微小彩纸、原创六边形标记、favicon 和简单控制符号。没有照片、肖像、位图、导入插图、3D 模型或生成图像。竞技场本身是大型高工艺视觉锚点;它必须在加载时清晰显示二十个带编号的球,而不是空容器或静态占位符。 ## 页面与区块 ### [BRAND] - [TOY_NAME] (`index.html`) 1. **页头与邀请语** — 页头左侧:一个原创的描边六边形标志,带三个糖果色圆点和 [BRAND] 字标。页头右侧:低调的标签 A pocket-sized physics playground,以及一个 How it moves 按钮,点击后展开工作区下方的说明性折叠面板,并将其滚动到可视区域。可见的介绍部分包含眉题 SPIN / BOUNCE / REPEAT、标题 [HEADLINE](默认 Give chaos a little spin.),以及正文 A candy-colored playground for curious minds taking a two-minute creative break. Twenty little balls. One spinning world. 当变量变化时,正文必须基于 [AUDIENCE] 和 [EXPERIMENT_THEME] 重写。介绍区右边缘显示一个原创的五点糖果色样和一个小标签 No score. Just play. 不要将模板标题重复用作品牌。 布局:页面背景为纯色 #1B1464。在 1440px 宽度下,居中一个最大 1280px 的外壳,水平内边距 32px。页头高 64px,白色 Fredoka 字标为 24px,青色描边图标和淡紫色辅助文案。介绍区在其下方 18px 处开始;标题为 Fredoka 600、56px/1.02,最大宽度 640px,除最后一个有意义的词渲染为纯色 #C7F43F 外均为白色。保持 [HEADLINE] 中的彩色词动态生成,而非硬编码 spin。正文为 DM Sans 400、16px/1.5、#DCD6FF,最大宽度 590px。移动端使用 16px 外壳内边距、56px 页头、21px 字标,隐藏纯装饰性的页头标语,使用可见的 44px How it moves 图标/文字按钮和 36px/1.03 标题。介绍区和实际竞技场都必须出现在首个 390x844 视口内。 动效:仅按钮交互在 120ms 内过渡。无介绍飞入、延迟文字显现、自动跑马灯或视差效果。 2. **交互式糖果竞技场** — 竞技场顶部条:左侧为 [TOY_NAME],右侧为一个青色圆点加 Live、Paused 或 Reduced motion。场景是真正的实时 Canvas 2D 模拟,由无障碍说明描述:Twenty glossy numbered balls bounce inside a rotating hexagon. Change the controls to explore candy collisions and joyful little surprises. 基于 [EXPERIMENT_THEME] 重写主题短语。清晰绘制全部二十个数字、五种光泽糖果色和旋转边框。将主操作栏直接放在画布下方;确切标签和行为在 Tuning lab and transport 中定义。保持一个视觉隐藏的文本摘要,同步运行状态、实际数量、旋转方向和时间因子,但不逐帧播报。实现真正的二维刚体圆盘运动,而非循环动画。将物理保持在方形世界中,x 向右、y 向下,宽度和高度为 1000 世界单位,竞技场中心 C=(500,500),正六边形外接圆半径 420,球半径相等 r=27,质量 m=1,圆盘转动惯量 I=0.5*m*r*r。在每个屏幕上使用相同的逻辑世界;仅调整绘制变换。默认 20 个球,标记为 1 到 20,循环粉色、橘色、青柠色、青色和紫色,使每种颜色出现四次。每个球具有 x/y 位置、x/y 速度、角位置和角速度。渲染的数字和一条小弧形接缝随该球的角位置旋转;反射可以保持光照固定。用 137 播种确定性 PRNG,将初始球放置在上部中心附近的交错五列四行簇中,中心间距 61 单位,带小的非重叠抖动和小的变化初始速度。检查每个初始圆盘与多边形及其他圆盘;被拒绝的样本必须重试。初始六边形角度为 -PI/6,其默认有符号角速度为 +30 度每秒,即在画布坐标中为顺时针。当允许普通运动时,初始簇在第一个渲染帧开始下落。 运行 requestAnimationFrame 进行渲染,并使用时间累加器进行物理计算,基础步长为 1/240 秒。将真实帧增量限制在 0.05 秒,追赶限制为 12 个基础步,并在标签页恢复时丢弃多余滞后,而不是推进一个大的不安全跳跃。通过向累加器添加 delta*0.25 来应用慢动作,绝不通过降低碰撞质量来实现。在每个基础步中,进一步细分,直到任何球和墙的最大预期相对平移至多为 0.35*r;在该估计中包含最大球速、abs(竞技场角速度)*420 和重力。最多使用 16 个微步,下面指定的速度限制确保该界限仍然可达。保存先前和当前的位置/角度,以便平滑渲染插值。暂停会冻结球、墙角度和接触粒子;暂停时仍可更改系数。每当暂停状态或文档可见性变化时重置累加器,并在文档隐藏时暂停更新。 对于每个微步,将竞技场角度推进 omega*h,计算其六个顶点 a_i=C+420*(cos(theta+i*PI/3),sin(theta+i*PI/3)),用半隐式欧拉积分重力 g=(0,900*gravityMultiplier),对线速度应用指数空气阻尼 exp(-0.10*h),对角速度应用 exp(-0.16*h),并积分球的方向。使用防御性线速度上限 1800 世界单位/秒和角速度上限 24 弧度/秒;这些是数值保护措施,不能替代正确的碰撞。保持有限值保护,使畸形状态无法污染整个画布。 在每个微步中,以 8 次顺序接触迭代求解每个唯一球对以及每个球与所有六个墙半平面的碰撞。对于此顶点顺序中的有向边 a 到 b,e=b-a,内向单位法线为 n=(-e.y,e.x)/length(e)。带符号圆盘中心距离为 d=dot(p-a,n)。圆盘需要 d>=r。如果 d<r,将其中心向内移动穿透深度加上一个微小的 0.01 单位余量。使用边界线上的最近点 q=p-d*n 作为墙的接触速度,vw=(-omega*(q.y-C.y),omega*(q.x-C.x)),其中 omega 单位为弧度/秒。圆盘的面向墙接触偏移为 rb=-r*n;其接触速度为 v+(-ballOmega*rb.y,ballOmega*rb.x)。计算相对于 vw 的相对速度,使移动的墙真正给予或获取能量。如果 vn=dot(relative,n)<0,应用法向冲量 jn=-(1+restitution)*vn*m,墙恢复系数为 0.76 用于高能碰撞,当 abs(vn)<35 时恢复系数为 0,消除微小的永久弹跳。使用切线 t=(-n.y,n.x) 解决切向摩擦:jt=-dot(relative,t)/(1/m+cross(rb,t)^2/I),限制在正负 friction*abs(jn) 范围内。应用线性冲量 (jn*n+jt*t)/m 和旋转冲量 cross(rb,jt*t)/I。在法向冲量后重新计算相对接触速度。对于静止墙接触,允许摩擦限制使用 max(abs(jn),m*max(0,-dot(g,n))*h),使旋转墙仍能拖动低速圆盘。将彩纸限制在真正新的高能碰撞上,而非每个求解器迭代。 对于圆盘对,n 从 A 指向 B,穿透深度=2*r-distance。均分位置校正,保留不超过 0.02 单位的接触容差;使用确定性非零法线处理重合中心。接触偏移在 A 上为 +r*n,在 B 上为 -r*n。计算两个接触点速度,包括角项。令 relative=contactVelocityB-contactVelocityA;当 dot(relative,n)<0 时,应用等大反向的法向冲量,逆质量总和为 2/m,对恢复系数 0.80 高于相同的 35 单位阈值,否则为 0。重新计算切向速度,并使用分母 2/m+cross(rA,t)^2/I+cross(rB,t)^2/I 将切向冲量限制为摩擦乘以法向冲量。应用等大反向的线性冲量和角冲量,符号一致。这必须在擦碰接触中传递可见的旋转。分离一对时,不要应用新的吸引法向冲量。在对校正后重新检查所有墙半平面,并在每个微步结束时进行最终向内投影,包括角落;可见边框和物理边界必须完全一致。不要定期将球传送回中心作为逃逸修复。 与墙壁和球对接触时,若其入射法向速度超过 170 世界单位/秒,可发射 3 个使用五种调色板颜色的小矩形。为每个接触键存储独立的 0.10 秒冷却时间,最多同时存在 120 个粒子;每个粒子存活 0.18-0.38 秒,沿各自的短弹道弧线运动并平滑淡出。纸屑是实际接触点处的附加装饰,绝不是全屏爆发。根据实际状态报告实时球数、旋转方向和模拟速度;不要编造 FPS、能量或科学测量值。 布局:在宽度 1100px 及以上时,工作区为两列网格,包含一个灵活的竞技场列和一个 328px 的调参列,间距 24px;对齐两者顶部,并使竞技场卡片高度为 592px。竞技场使用 #241B7A,实心 2px #130D3F 轮廓,28px 圆角,以及清晰的 8px #130D3F 下方阴影。一个 220px 实心 #FF3DA4 圆形被裁剪到左上背景中,一个 260px 实心 #FF8A34 半圆被裁剪到右下背景中,它们是物理六边形之外的大块可见表面;它们绝不覆盖边缘、球、文案或控件。实际六边形以完全不透明度填充 #130D3F,带有 8 世界单位的 #25E5F2 边缘、克制的 12 单位青色辉光和精细的白色内嵌边。避免削弱颜色的透明度。40px 顶部条使用白色/淡紫色文字,64px 操作栏位于画布下方。画布填充剩余高度,其绘制变换使用 scale=min(cssWidth,cssHeight)/1000 并以世界坐标居中,在旋转外接圆之外至少留出 6% 内边距。将 devicePixelRatio 上限设为 2,并在每次尺寸变化后重置画布变换。球的基础颜色循环使用五种精确色相;添加较暗的下方月牙和小白色高光椭圆,然后添加白色中央数字圆盘,使用 #130D3F Fredoka 600 数字,大小为 30 世界单位。除固定于光照的高光外,所有球表面和数字圆盘一起旋转。使用柔和的小接触阴影,而不是在数字上模糊。在 760-1099px 时使用灵活的竞技场和 300px 控制面板,最小舞台高度 530px。在 759px 及以下时堆叠卡片;竞技场卡片在 390px 宽度时高度约为 424px,包含 32px 顶部条、326px 画布区域和 64px 操作栏。场景必须在每个旋转角度下完全可见,不裁剪任何六边形顶点。移动端渲染保持相同的世界物理、半径和调色板,而不是使用更小的物理竞技场。 运动:物理墙壁和数字接缝按其实际求解角度旋转。保持连续渲染平滑,不用 CSS 振荡替代模拟。纸屑仅在高能接触时出现,上限 120 个粒子并平滑淡出。页面和画布背景绝不抖动或闪烁。在 prefers-reduced-motion 下,加载时渲染精致的静态排列,将状态设为 Reduced motion,禁用纸屑和装饰性运动,并显示明确的 Start motion 按钮;只有有意点击才开始物理模拟。该点击之后,保持 reduced-motion 纸屑禁用。用户可随时 Pause。 3. **调参实验室与传输** — 侧面板标题为 Tuning lab,并带有辅助文案 Make a tiny change. Watch a different world. 使用四个带标签的原生范围控件,并带有持久关联的输出值:Gravity 为 0.00x-2.00x,步长 0.05x,默认 1.00x,乘以 900 世界单位/秒的平方;其辅助说明为 Pull toward the floor。Friction 为 0.00-0.80,步长 0.01,默认 0.18,用作墙壁和球对接触时的库仑系数;辅助说明为 Slippery to grippy。Spin 为 -120 到 +120 度/秒,步长 5,默认 +30;显示 30 degrees/s clockwise、0 degrees/s stopped 或相应的逆时针值。Balls 为整数 4-40,默认 20;辅助说明为 More company, more collisions。在计数值旁以及范围输入旁使用紧凑的减号按钮和加号按钮;将两个按钮限制在相同边界。重力、摩擦和旋转变化在下一个物理微步应用,不重新初始化球的位置。在零重力下,运动中的球继续受空气阻尼;不要悄悄重新启用重力。在零旋转下,物理墙壁停止,但球继续运动。在摩擦为零时移除接触摩擦,而不是悄悄保留它。 更改数量时保留现有的低编号球:先移除最高 ID;使用最多 250 次不重叠采样尝试在多边形内添加新 ID,圆盘之间至少间隔 2 单位。如有必要,在后续微步中将剩余生成尝试分散到整个安全内缩的竞技场中。绝不要生成重叠圆盘、将它们放在墙壁外,或悄悄报告尚未出现的请求数量;当排队的生成仍存在时显示 Adding balls,然后显示真实总数。可访问的计数状态仅在完成数量更改时更新。Reset 清除任何待处理的生成。 在范围控件下方,显示三个实验芯片:Candy tumble、Float party 和 Sticky spiral。Candy tumble 设置重力 1.00x、摩擦 0.18、旋转 +30 度/秒和 20 个球;Float party 设置 0.20x、0.06、+45 和 20;Sticky spiral 设置 0.70x、0.55、-55 和 28。选择芯片会更改这些参数和数量,而不重置现有物体。仅当每个当前设置都等于该预设时高亮芯片。默认主题的小型预设描述为 A cheerful pile-up、Light on their feet 和 Take the scenic route。为不同的 [EXPERIMENT_THEME] 重写这些名称和描述,同时保留这些数值配方。芯片下方的 Reset toy 文本按钮恢复默认数值配方、初始六边形角度、确定性 20 球簇、法向速度和空纸屑。保留用户的暂停/运行状态,绝不覆盖 reduced-motion 暂停。选中的预设更改绝不悄悄退出慢动作。 竞技场操作栏包含 Pause、Shake it up 和 Slow motion。Pause 切换为 Resume,并带有适当的按下状态。Shake it up 为每个现有球施加独立种子的向上冲量 350-750 单位/秒、水平冲量 -500 到 +500 以及角冲量 -8 到 +8 弧度/秒,钳制到安全速度限制,并播报 Shake added。它不会重置竞技场或球数。如果处于暂停状态,冲量会被存储并在 Resume 时生效;状态显示 Shake ready - resume to release。Slow motion 是 1.00x 和 0.25x 模拟时间之间的切换,激活时标记为 Slow motion on。相邻的紧凑指示器显示 1x time 或 0.25x time。无需声音。包含一个原生 details 披露块 Keyboard shortcuts,其中 Space:暂停或恢复,S:摇晃,M:慢动作,R:重置。快捷键处理程序忽略可编辑控件、范围输入、contenteditable 元素和修饰键组合;聚焦的原生输入保留其浏览器键盘行为。所有操作也支持点击或轻触。 布局:Tuning 卡片在桌面端宽 328px、高 592px,24px 圆角,2px #130D3F 边框和相同的 8px 下方阴影。其纯色 #C7F43F 头部高 76px,深色墨水 Fredoka 600 标题为 24px,深色墨水辅助文字为 12px。主体为 #1B1464,内边距 20px。将四个控件垂直排列,间距 16px;每个控件左侧使用白色 14px 粗体标签,右侧使用等宽白色数值输出,44px 高的输入目标内包含 6px 轨道,20px 纯色亮色滑块带深色轮廓,#DCD6FF 辅助文字为 12px。重力、摩擦、旋转和计数分别使用橘色、青柠色、青色和紫色填充。正文文本绝不使用低透明度霓虹色。预设为三个紧凑堆叠行,最小可见高度 36px,目标高度 44px;选中行为纯色亮粉色配深色墨水文字和勾选图标;其他行有细青色轮廓和白色标签。Reset 是 44px 文本按钮行。竞技场操作栏有三个控件:Pause 为 44px 白色描边靛蓝色按钮,Shake it up 为视觉上最大的 44px 亮粉色按钮配深色文字,Slow motion 为 44px 靛蓝色胶囊按钮,选中时变为纯色青柠色配深色文字。移动端使用 12px 水平舞台内边距、8px 间距和简短可见标签 Pause、Shake 和 Slow 0.25x,同时保留完整的无障碍名称。三者均适配 358px 竞技场宽度而不溢出。在 759px 及以下,Tuning 卡片在竞技场下方全宽;使用无障碍披露摘要 Tuning lab,右侧显示当前计数和重力,初始为折叠状态。展开后以正常文档流显示所有控件,无模态或固定覆盖层;其头部保持纯色青柠色。桌面端显示展开的 Tuning 主体,无披露提示。 动效:滑块变化立即更新输出和实时物理。原生范围控件保持键盘可访问。按钮使用 2px 按下位移持续 100ms,以及可见的 3px 青色聚焦环带 3px 间隙;减少动效时省略位移。仅在礼貌实时区域播报离散的计数、重置、摇晃和暂停事件。避免逐帧实时播报。 4. **How it moves 与页脚** — 在工作区下方,包含一个原生 details 块,摘要为 How it moves,单行预告为 Small rules. Delightful results. 其三行简洁内容为:Gravity pulls every ball down. Turn it off to watch the wall do the work. / Friction trades sliding for spinning. Look closely: the numbers turn with each ball. / The wall is moving too. A fast edge can give a ball an extra kick. 在这些行下方使用声明 This is a playful model, not a measurement tool. 对于教育性 [EXPERIMENT_THEME],围绕所提供主题重写预告和支持行,同时保持这些物理事实正确。包含上文指定的 Keyboard shortcuts details 块。页脚左侧:[BRAND]。页脚右侧:Made for a tiny break. 将该行改写以匹配 [AUDIENCE] 的替代主题。当周围提示提供时,一个小的可选 [CREDIT] 链接可跟在页脚之后;没有日期、版权年份、外部社交链接集、注册或新闻通讯表单。 布局:在工作区下方 24px 处使用整洁的单一水平带,带细青色顶部边框,而非大型教程区块。How it moves 摘要为紫色 #A56BFF 胶囊配 #130D3F 文字和原创加/减图标;预告和展开说明文字在 #1B1464 上使用白色和 #DCD6FF。展开的 details 在桌面端为三列短文本网格,移动端为堆叠行,内边距 20px,字体 14px/1.5 DM Sans。页脚高 48px,13px 淡紫色文字,桌面端左/右对齐,移动端两行 flex 换行。展开的 details 自然增长页面;没有内容隐藏在粘性 UI 后面。 动效:Details 立即打开,无高度动画。头部 How it moves 按钮将此 details 元素设为打开,将键盘焦点移至其摘要,并仅在减少动效关闭时使用平滑滚动将其滚动到视图中。 ## 资产 - 字体:在本地安装 @fontsource/fredoka,并导入其 Latin 500.css 和 600.css 文件;在本地安装 @fontsource/dm-sans,并导入 Latin 400.css、500.css 和 700.css。仅将使用到的 woff2 文件打包到 dist/ 中,并使用相对资源路径。包源为 https://www.npmjs.com/package/@fontsource/fredoka 和 https://www.npmjs.com/package/@fontsource/dm-sans。Fredoka 由 Milena Brandao 设计,DM Sans 由 Colophon Foundry 设计,两者均为 OFL-1.1。在 ASSETS.md 中记录实际的本地路径、原作者、包源 URL 和许可证文件。不要使用 Google Fonts 或其他远程样式表。 - 图标:在本地为播放、暂停、摇晃、重置、加、减、勾选和六边形项目标记编写极简内联 SVG 图标。使用 24x24 viewBox、2px 圆角描边和 currentColor。在 public/favicon.svg 绘制本地 SVG 六边形 favicon。这些是原创几何符号,不是复制的徽标资产。在 ASSETS.md 中将它们标记为本地编写。 - 图像:使用上述精确的调色板和几何形状,在 Canvas 2D 中于运行时生成竞技场、光泽球、白色数字圆盘、彩色背衬形状和微小接触彩纸。不使用下载或生成的图像文件,因此不需要图像 URL 或 images.json。画布需要在页面中提供其描述性无障碍说明。 ## 不要做 - 不要用 React、图形引擎、物理引擎或托管服务替换固定的 Vite + 原生 TypeScript + Canvas 2D + 原生 CSS 技术栈。使用 npm run build,并且只在 dist/ 中输出静态生产文件。 - 不要添加后端、服务器代码、API 路由、数据库、身份验证、外部表单、支付、分析、遥测或第三方 API。所有控件完全在浏览器内存中运行。 - 不要使用绝对根路径的资源 URL 或仅指向目录的内部链接。将 Vite base 设为 ./;每个内部页面链接都必须包含 ./index.html 或其他真实的 HTML 文件名,或使用 #/ 哈希路由。此玩具只有一个 index.html 页面。 - 不要在 dist/ 中发布未压缩的生产代码、source map、源文件或 src/。保持整个 dist/ 在 20 MB 以下,并使其能从任意静态子目录加载。 - 不要从 CDN 或远程主机加载字体、脚本、样式、图片、声音或图标。仅从 Fontsource 自托管指定的 OFL 字体,将其 woff2 文件和许可证本地打包。 - 不要添加除宽松的 MIT、ISC、BSD-2-Clause、BSD-3-Clause、Apache-2.0、0BSD、CC0-1.0、Unlicense 或字体用 OFL-1.1 之外的 npm 依赖。不要使用受限的 UI 源码、购买的模板、未授权的代码、CC BY-NC 或 CC BY-SA 资源。 - 不要复用源站点的产品名称、标语、文字标识、提示词文本、实现、文案、控件组合、截图、视频、自定义字体或独特图标。竞技场、美术、favicon 和界面必须独立创作。 - 不要包含真实品牌标志、可识别的产品、真实人物、可识别的角色、库存照片、远程占位符、第三方艺术作品或 3D 引擎。这个代码绘制的玩具不需要图像生成步骤,也不需要 images.json。 - 不要留下任何未记录的第三方字体文件。ASSETS.md 必须列出其本地路径、包来源、字体作者和 OFL-1.1 许可证;将原始 canvas 和 SVG 作品标记为本地创作。 - 不要把霓虹流行配色变成奶油色、白色、灰色、黑色、粉彩色或低饱和度表面。保留 #1B1464 作为页面背景,并在两种情况下都保留 #FF3DA4、#FF8A34、#C7F43F、#25E5F2 和 #A56BFF。亮粉色和橘色必须占据竞技场的大块背景形状;青柠色必须占据调参标题栏;青色必须勾勒物理竞技场的轮廓。强烈的颜色不能只局限于小按钮。 - 不要在明亮颜色上使用白色正文文本、低不透明度正文文本或无法阅读的微弱禁用/聚焦状态。在明亮表面上使用 #130D3F 文本,在靛蓝色上使用白色/#DCD6FF;保持正常文本符合 WCAG AA,并为每个交互元素提供可见的聚焦状态。 - 不要在首个移动端视口中省略实时竞技场、将其隐藏在排版后面、用控件遮挡、在旋转时裁切顶点或让页面水平溢出。在 1440x900 和 390x844 下验证完整的默认布局,控制台零错误。 - 不要使用预录动画、CSS keyframes、逐帧随机位移或库作为球的物理。直接实现所有墙/球和球/球冲量、角效应、摩擦、重力、阻尼和位置修正。 - 不要使渲染的六边形和求解器边界不一致。使用相同的六个世界空间顶点、中心和角度;对每个墙壁冲量使用移动墙壁接触速度 omega cross (q-C),包括符号和弧度。 - 不要丢弃或伪造 20 个带编号的默认球。所有整数 1 到 20 必须初始各出现一次,五种糖果色均匀重复,具有光泽阴影和真实的数字/接缝旋转。数量变化必须显示真实的当前数量,并保留较低的 ID。 - 不要让球逃逸、穿过角落、持续重叠、陷入静止堆中、获得 NaN 状态或产生无休止的静止抖动。使用上述固定时间累加器、自适应碰撞微步、8 次接触迭代、低速恢复阈值、成对修正和最终向内墙壁投影。不要使用周期性重生或中心传送逃逸修复。 - 不要用无界的帧增量推进物理、在最大带符号旋转下失去稳定性、使用慢动作来减少求解器迭代,或在隐藏标签页返回后运行追赶。保留指定的 1/240 秒基础步长、相对平移微步界限、安全速度上限和累加器重置。 - 不要混淆角速度单位或摩擦符号。竞技场控件是度每秒;求解器角度值是弧度每秒。接触速度必须包含球角速度。成对冲量必须等大反向,摩擦必须与切向滑动相反。 - 不要对已经分离的物体施加碰撞法向冲量、将摩擦零作为仅视觉变化、静默重新启用零重力,或在零旋转下继续旋转物理边界。所有参数设置都必须有真实可观察的效果。 - 不要在滑块、预设、慢动作切换或数量变化时重置或传送球状态。只有 Reset toy 会重新初始化世界。在当前旋转的多边形内生成新球且不重叠;如有需要,透明地排队添加。 - 不要省略 Gravity、Friction、Spin、Balls、Shake、Pause/Resume、Slow motion、预设或 Reset toy。上述精确范围、默认值和数值配方是必需的。选中的预设仅在其实际设置匹配时保持选中。 - 不要将 Shake 实现为移动 canvas 或整个页面。它添加每个球的线性和角冲量。暂停时,存储冲量,报告就绪状态并等待 Resume。Pause 将墙壁、球和粒子一起冻结。 - 不要让微小纸屑变成连续的视觉噪音。仅在新的高能物理接触时发射,使用每次接触冷却时间,上限为 120 个活跃粒子,遵守生命周期限制,并在减少动态效果时完全禁用纸屑。 - 不要为偏好减少动态效果的用户自动播放物理。以构图良好的静止状态开始,提供明确的 Start motion 操作和 Reduced motion 状态;只有直接用户意图才能启动它,并且 Pause 必须保持可用。在该偏好下省略装饰性动态和平滑滚动。 - 不要依赖悬停、拖拽、键盘快捷键或 canvas 命中目标来执行基本操作。每个操作都需要可见的语义 HTML 控件、关联标签、键盘访问、44px 触摸目标和清晰的选中/按下状态。范围输入保留原生键盘行为。 - 不要在焦点位于可编辑控件或范围输入时拦截快捷键。仅当全局暂停快捷键实际处理该键时才阻止 Space 滚动。不要每帧将物理事件流式传输到实时区域。 - 不要在移动端使用模态框或固定调参覆盖层。保持竞技场优先的堆叠布局、可用的可展开青柠色调参标题栏、响应式 canvas 后备分辨率和所有控件在可到达的文档流中。 - 不要编造 FPS、能量、用户数、科学准确性或流行度声明。可见计数、运行状态、方向和时间因子必须来自实际模拟状态。这是一个玩具,而不是测量工具。 - 不要在 src/content.ts 之外的任何地方硬编码默认品牌词。将所有提供的变量应用于标题栏、标题、竞技场说明、介绍、预设名称/描述、解释性文本、页脚和无障碍标签;在保留定义的物理和布局的同时,连贯地重写依赖主题的文案。 - 不要显示日期、年份、倒计时、发布时间戳或前端版权年份。保持所有可见内容、示例文本、状态标签、alt/无障碍文本和变量默认值为美式英语。 - 不要在网站本身提及 VibeFather,除了可选的 [CREDIT] 页脚链接。不要在网站或产品文案中提及竞争对手、比较声明或参考品牌名称。 - 不要添加 SEO 部分、meta 描述、Open Graph 标签、JSON-LD、sitemap 工作、新闻通讯、定价或营销漏斗。仅使用普通的 [BRAND] 文档标题和原始本地 favicon。 - 不要将任何交互留作无效的装饰性控件。交付前运行生产构建,检查默认桌面/移动视图,在两个极端操作每个范围,测试正/负/零旋转,切换所有预设,达到 40 个球,反复摇动,暂停/恢复,重置并使用 0.25x 时间;观察扩展的最坏情况模拟以检查包含性和有限状态。 - 不要跳过减少动态效果和调整大小的验证:确认明确的启动状态、禁用的纸屑、调整大小时保留状态、可用的移动端展开以及无控制台错误或水平溢出。在发布前修复实际缺陷。 --- Inspired by Spinning Hexagon Physics Toy by @GlanceHall — https://glancehall.com/blog/coding-agents/codex-projects — Prompt by VibeFather · https://vibefather.ai/t/spinning-hexagon-physics-toy · 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: "Spinning Hexagon Physics Toy"
colors:
deep_indigo: "#1B1464"
arena_indigo: "#241B7A"
inner_ink: "#130D3F"
hot_pink: "#FF3DA4"
tangerine: "#FF8A34"
lime: "#C7F43F"
cyan: "#25E5F2"
violet: "#A56BFF"
paper_white: "#FFFFFF"
lilac_text: "#DCD6FF"
typography:
wordmark_main_headline_arena_title_and_large_control_headings: { family: "Fredoka", weights: [500, 600] }
body_labels_helper_text_statuses_and_numeric_outputs: { family: "DM Sans", weights: [400, 500, 700] }
spacing: "Use a 4px base grid. Desktop shell max-width 1280px with 32px side padding, 24px workspace gap, 20px card interiors, 16px control gaps and 24px before the explanation/footer band. Header 64px; mobile shell 16px, header 56px, card interiors 16px and gaps 16px. Keep the desktop workbench visible within the 1440x900 first screen and the mobile headline, whole arena and transport visible within 390x844. Avoid giant empty spacer sections."
radius: "Arena 28px, tuning card 24px, ordinary buttons 14px, preset rows 10px, pills fully rounded. Use solid 2px dark ink outlines and a crisp 8px downward dark ink shadow to give the toy a physical, chunky edge; do not use a glass-dashboard card system."
---
# Spinning Hexagon Physics Toy — 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
- **Deep indigo** `#1B1464` — Mandatory dominant page background, header, footer and right-hand control-card body; never replace with black or a muted neutral. It remains visible around every section.
- **Arena indigo** `#241B7A` — Arena panel backing and control disclosure backing, distinct from the deep indigo page.
- **Inner ink** `#130D3F` — Hexagon interior, dark text on all five bright colors, ball number glyphs, slider outlines and solid control-card borders.
- **Hot pink** `#FF3DA4` — Large clipped upper-left circle behind the arena, one fifth of the balls, selected experiment tab, and the full-width Shake it up button. Pink covers an actual hero surface, not only a small accent.
- **Tangerine** `#FF8A34` — Large lower-right arena semicircle, one fifth of the balls, gravity-slider fill and action-button pressed state.
- **Lime** `#C7F43F` — Solid 76px-high Tuning lab card header, one fifth of the balls, active slow-motion pill and friction-slider fill. Dark ink text only.
- **Cyan** `#25E5F2` — Broad luminous hexagon edge, one fifth of the balls, spin-slider fill, keyboard focus rings and active status dot.
- **Violet** `#A56BFF` — One fifth of the balls, count-slider fill and the How it moves disclosure label background; use dark ink labels on violet.
- **Paper white** `#FFFFFF` — Main headings, control labels, readable value outputs, ball-number badge discs and small glossy reflections.
- **Lilac text** `#DCD6FF` — Secondary body text on the indigo backgrounds; use solid color rather than low-opacity white.
## Typography
- **Wordmark, main headline, arena title and large control headings** — Fredoka (OFL), weights 500/600. Self-host the font files.
- **Body, labels, helper text, statuses and numeric outputs** — DM Sans (OFL), weights 400/500/700. Self-host the font files.
## Spacing & shape
- Spacing: Use a 4px base grid. Desktop shell max-width 1280px with 32px side padding, 24px workspace gap, 20px card interiors, 16px control gaps and 24px before the explanation/footer band. Header 64px; mobile shell 16px, header 56px, card interiors 16px and gaps 16px. Keep the desktop workbench visible within the 1440x900 first screen and the mobile headline, whole arena and transport visible within 390x844. Avoid giant empty spacer sections.
- Radius: Arena 28px, tuning card 24px, ordinary buttons 14px, preset rows 10px, pills fully rounded. Use solid 2px dark ink outlines and a crisp 8px downward dark ink shadow to give the toy a physical, chunky edge; do not use a glass-dashboard card system.
## Motion
- Use requestAnimationFrame rendering with a 1/240-second physics accumulator and adaptive collision microsteps, independent of frame rate. The detailed numerical solver in Interactive candy arena is part of the implementation requirement.
- Ball numbers and seams rotate with their computed angular state; wall rotation, contact impulses and friction are physical. Keep the five-color gloss legible throughout motion.
- Energetic contact confetti has a per-contact cooldown, lifetime below 0.4 second and maximum 120 particles. No strobe, full-screen flash, page shake, parallax, autoplay audio or ornamental reveal choreography.
- Respect prefers-reduced-motion by initially pausing in a polished still state, exposing Start motion and disabling confetti/decorative transitions. Ordinary users start automatically. Pause and Resume always remain available.
- Buttons have only a 100-120ms color/press response. Native details open immediately. No smooth scroll or press displacement with reduced motion.
## Imagery
Everything is drawn in code: glossy spheres, physical arena, two saturated backing shapes, tiny confetti, original hexagon mark, favicon and simple control symbols. There are no photographs, portraits, bitmaps, imported illustrations, 3D models or generated images. The arena itself is the large high-craft visual anchor; it must show twenty numbered balls clearly on load, not an empty container or static placeholder.
## Tone
Tactile, bright, curious and concise. Write friendly US English with concrete action labels. No pseudo-scientific claims, onboarding wall or marketing filler. Default copy appears below; adapt every context-dependent sentence to supplied variable values and keep all content in src/content.ts.
---
Inspired by Spinning Hexagon Physics Toy by @GlanceHall — https://glancehall.com/blog/coding-agents/codex-projects
— Prompt by VibeFather · https://vibefather.ai/t/spinning-hexagon-physics-toy · CC BY-NC 4.0 (non-commercial; commercial use needs a VibeFather Pro license) · Request removal: https://vibefather.ai/takedown
改成你自己的
- 科学博物馆的展厅一体机:把 BRAND 设为博物馆,TOY_NAME 设为展项名,EXPERIMENT_THEME 设为碰撞与动量,然后为路过的访客保留摇一摇和慢动作控件。
- 编程训练营的演示日页面:把 AUDIENCE 设为潜在学员,HEADLINE 设为展示会标题,并让「它是怎么动的」折叠说明指向班级在 canvas 里实现的物理。
- 创意工作室的休息区页面:把 BRAND 设为工作室名,TOY_NAME 设为一个内部玩具,并围绕项目之间两分钟的放松时间重写预设说明。
- 物理老师的力学工作坊:把 AUDIENCE 设为学生,EXPERIMENT_THEME 设为重力与摩擦力,并重写每个预设标签,描述它所演示的力。
旋转六边形物理玩具:常见问题
访客在旋转六边形物理玩具页面上实际能改什么?
旋转六边形物理玩具的访客可以在场景运行时调整重力、摩擦力、带符号的墙壁旋转、球数和模拟速度,还可以按「摇一摇」按钮注入新的能量,或打开慢动作。一个「它是怎么动的」折叠说明解释了这些控件,调节实验室在桌面端位于场地旁边,在手机上位于场地下方。
怎么用 AI 做一个旋转六边形物理玩具?
复制本页的提示词,或者运行 npx vibefather add spinning-hexagon-physics-toy,把 [BRAND]、[AUDIENCE]、[HEADLINE]、[TOY_NAME] 换成你自己的内容,再粘贴到 Claude Code、Codex、Cursor 等 AI 编程工具里。在线演示就是用这份提示词原样做出来的。