ai21.net
语言

Three.js牛顿摆:Opus对比Astra 6

演示视频

Three.js牛顿摆:Opus对比Astra 6 — 1

提示词

Build a complete, single-file HTML/Three.js experience showing an exceptionally beautiful, interactive Newton’s cradle.

Use the attached image as the reference for the recognizable construction: five polished metal balls suspended inside two parallel chrome frames.

The result should feel like a luxury product filmed in a real photography studio, with convincing materials, graceful pendulum motion, and working collision physics.

Open directly into the finished scene. The first rendered frame must already be composed beautifully enough to use as a video thumbnail.

Prioritize three things equally: the beauty of the chrome, the physical construction, and the correctness of the motion.

Create a square, recording-ready composition that adapts to the browser without stretching. Center one substantial Newton’s cradle on a seamless warm-ivory studio surface.

Use a fixed camera positioned mostly in front of the cradle, slightly above the balls and slightly off-center. Show enough depth to distinguish the front and rear frames, while keeping all five balls easy to count.

Use a restrained product-photography perspective, approximately equivalent to a 70mm lens. Avoid a wide-angle appearance.

The cradle should fill most of the image. Leave comfortable margins for the full outward swing on both sides. Neither the balls nor the frame may leave the image during normal operation.

Keep the camera stationary throughout. No orbiting, automatic zoom, camera shake, or cuts.

Construct exactly five identical, perfectly round polished stainless-steel spheres.

At rest, their centers must form one horizontal row, with neighboring spheres touching. Their diameters, masses, and suspension lengths must match.

Use two slender, parallel, inverted-U chrome support frames with rounded corners, positioned in front of and behind the ball row.

Each ball must hang from two fine, taut suspension wires: one connected to the front support and one to the rear support. These wires constrain its motion to the shared vertical swing plane.

Include small, believable attachment details. The wires must connect visibly to the balls and frame.

The support frame and anchors remain completely stationary. Update the suspension geometry from the actual ball positions every frame. Wires must never stretch, disconnect, pass through the spheres, or wave independently.

Choose elegant proportions: substantial spheres, slender tubular supports, and enough suspension length for a satisfying swing. Avoid thick ropes, oversized frames, and a bulky decorative base.

Make the metal look convincingly reflective.

Use physically based metallic materials, high-quality sphere geometry, restrained surface roughness, and a carefully designed reflection environment.

Create large studio-softbox reflections that wrap naturally around the spheres and curved frame. Include broad bright highlights, darker reflected regions, and subtle warm tones from the studio.

The spheres must retain readable volume. Avoid flat gray metal, featureless white balls, plastic shading, and excessive bloom.

Build the reflection environment procedurally inside the file. Do not depend on downloaded HDR images or external texture assets.

Use a large soft key light from the upper-left, gentle fill from the opposite side, and a restrained rim light to define the metal against the background.

Add soft contact shadows beneath the frame and moving shadows beneath the balls. Shadows should follow the motion and help communicate height.

Keep the background uncluttered, with a very subtle ivory gradient. The overall image should feel calm, precise, and expensive.

Implement a working simplified Newton’s cradle simulation.

Represent each sphere as an equal-mass pendulum with an angular position and angular velocity. Gravity must drive the swing. Derive the sphere positions from the pendulum geometry.

Use stable time integration and collision handling that can propagate impacts through the full chain of touching balls.

A fixed timestep with sufficient substeps, event-based impacts, or a suitable constraint-aware solver is acceptable. Choose an approach that remains stable at different rendering frame rates.

Do not animate the balls with unrelated sine waves or a prerecorded sequence. The motion must respond to the simulated state and user input.

The required behavior is:

Release one outer ball. It swings into the row, transfers its motion through the chain, and approximately one ball swings outward at the opposite end.
The outgoing ball returns, strikes the row, and sends the original outer ball outward again.
Release two adjacent balls together from one side. Approximately two balls must swing outward together from the opposite side.
The remaining balls should stay close to their resting positions, allowing small physically plausible movement during impacts.
Motion transfers at contact. The outgoing balls must not begin swinging before the incoming balls reach the row.

Handle the chain of contacts consistently. A single order-dependent collision pass must not produce a different result when the direction reverses.

Collisions should approximately conserve momentum and kinetic energy over the brief impact interval, with small losses. Use gentle damping so the swing amplitude decreases gradually.

The simulation must not gain energy, accelerate indefinitely, visibly interpenetrate, jitter continuously, or send the entire row swinging after every impact.

The balls should accelerate toward the bottom of their arcs and slow naturally near their turning points. Avoid constant-speed swinging.

Start with the leftmost ball raised approximately 35 degrees and the other four hanging at rest. Hold this initial pose briefly, around 0.4 seconds, then release automatically.

The experience must immediately demonstrate the classic alternating motion without requiring a click. Continue running without an automatic reset.

Add a small, elegant control strip near the bottom edge with:

“1 BALL”
“2 BALLS”
Pause / Resume
Reset
“0.25×” slow motion

Keep these controls visually secondary. They must not overlap the cradle or its swing paths.

Selecting “1 BALL” or “2 BALLS” should reset the simulation, raise the corresponding leftmost ball or pair to the same release angle, briefly hold, and release.

Reset should restore and replay the currently selected mode.

Slow motion must scale simulated time while preserving the same physics. It must not change gravity, collision behavior, or suspension geometry.

Allow the user to drag either outer ball outward within its permitted swing plane, then release it. Clamp the drag angle to a sensible maximum, around 45 degrees. Keep its suspension wires taut throughout.

Add an “H” keyboard shortcut to hide or reveal the controls for clean recording.

Keep the experience silent. No music, collision sounds, particles, motion trails, impact flashes, explanatory overlays, large titles, model names, or decorative text.

Deliver one complete HTML file with inline CSS and JavaScript. Use one consistently pinned Three.js version and matching modules if needed.

No build step, backend, external models, external textures, or HDR downloads.

Initialize the renderer, camera, lighting, materials, and starting pose before revealing the canvas. Avoid a visible black startup frame.

Support browser resizing without distorting the scene. Aim for smooth performance on a normal laptop and cap pixel density sensibly.

Before finishing, check that:

Exactly five spheres remain visible and correctly suspended.
The complete frame and maximum swing fit inside the square composition.
One-ball mode transfers approximately one ball at each impact.
Two-ball mode transfers approximately two balls at each impact.
Pause, reset, slow motion, and dragging work.
Chrome reflections remain readable throughout the motion.
The scene appears immediately and produces no runtime errors.

Return the complete working HTML.

中文译文

构建一个完整的单文件 HTML/Three.js 体验,呈现一个极其精美、可交互的牛顿摆。

以所附图片作为这一可识别构造的参考:五颗抛光金属球悬挂在两个平行的铬金属框架内。

成品应像一件在真实摄影棚中拍摄的奢侈品:材质令人信服、摆动优雅,并且碰撞物理能正常工作。

直接打开即进入完成后的场景。第一帧渲染画面就必须构图精美,足以直接用作视频缩略图。

同等地权衡三件事:铬金属的美感、物理构造,以及运动的正确性。

创建正方形、可直接录制的构图,能自适应浏览器而不被拉伸。将一个体量充足的牛顿摆居中放置于无缝的暖象牙色影棚台面上。

使用固定机位,主要位于牛顿摆正前方,略高于球体并略微偏离中心。展现足够的景深,让前后两个框架能够区分,同时保持五颗球都清晰可数。

采用克制的产品摄影视角,约等效于 70mm 镜头。避免广角观感。

牛顿摆应占满画面的大部分。两侧留出舒适的边距,以容纳完整的外摆行程。在正常运行过程中,球与框架都不得离开画面。

全程保持机位静止。不要环绕、自动变焦、镜头抖动或剪辑。

精确构建五颗完全相同、浑圆、抛光的不锈钢球体。

静止时,它们的球心必须位于同一水平线上,相邻球体彼此接触。它们的直径、质量和悬挂长度必须一致。

使用两个细长、平行、四角圆润的倒 U 形镀铬支撑框架,分别置于球列的前方和后方。

每颗球都必须由两根纤细而紧绷的悬线吊起:一根连接前支撑,一根连接后支撑。这些悬线将其运动约束在共同的垂直摆动平面内。

加入小而可信的连接细节。悬线必须与球体和框架可见地相连。

支撑框架与锚点保持完全静止。每一帧都要依据球体的实际位置更新悬挂几何。悬线永不拉伸、断开、穿透球体,也不得各自独立摆动。

选择优雅的比例:饱满的球体、纤细的管状支撑,以及足以产生悦目摆幅的悬挂长度。避免粗绳、过大的框架和笨重的装饰底座。

让金属呈现出可信的反射质感。

使用基于物理的金属材质、高质量的球体几何、克制的表面粗糙度,以及精心设计的反射环境。

营造大型影棚柔光箱的反射,自然地环绕于球体和弯曲框架之上。包含宽阔明亮的高光、较暗的反射区域,以及来自影棚的微妙暖色调。

球体必须保持可辨识的体积感。避免扁平灰暗的金属、毫无细节的白色球体、塑料感着色以及过度的泛光。

在文件内部以程序化方式构建反射环境。不要依赖下载的 HDR 图像或外部贴图资源。

使用来自左上方的大面积柔和主光、来自对侧的轻柔补光,以及一盏克制的轮廓光,让金属在背景中凸显出来。

在框架下方添加柔和的接触阴影,在球体下方添加移动阴影。阴影应跟随运动,并有助于传达高度。

保持背景简洁,仅带极微妙的象牙色渐变。整体画面应显得平静、精确而昂贵。

实现一个可正常运行的简化牛顿摆模拟。

将每颗球表示为一个等质量摆,带有角位置与角速度。摆动必须由重力驱动。球体位置需从摆的几何关系推导得出。

使用稳定的时间积分与碰撞处理,使冲击能够沿整条相互接触的球链传递。

固定时间步长配合足够的子步、基于事件的碰撞,或合适的约束感知求解器均可。请选择一种在不同渲染帧率下都能保持稳定的方案。

不要用无关的正弦波或预录序列来驱动球体。运动必须响应模拟状态与用户输入。

要求的行为如下:

释放一颗外侧球。它摆入球列,将运动沿球链传递,另一端大约有一颗球向外摆出。
摆出的球返回、撞击球列,并再次将最初的那颗外侧球送出。
同时从一侧释放两颗相邻的球。对侧应大约有两颗球一同向外摆出。
其余球应保持在静止位置附近,允许在撞击期间出现小幅、物理上合理的移动。
运动在接触时传递。在入射球抵达球列之前,出射球不得开始摆动。

一致地处理整条接触链。单一的、依赖顺序的碰撞处理,在方向反转时不得产生不同结果。

碰撞应在短暂的撞击区间内近似守恒动量与动能,仅允许小幅损耗。使用轻柔的阻尼,使摆幅逐渐衰减。

模拟不得获得能量、无限加速、出现可见的相互穿透、持续抖动,或在每次撞击后让整排球都摆动起来。

球体应在向弧线底部运动时加速,并在接近折返点时自然减速。避免匀速摆动。

初始时将最左侧的球抬高约 35 度,其余四颗静止悬垂。短暂保持这一初始姿态,约 0.4 秒,然后自动释放。

该体验必须无需点击即可立即演示经典的交替运动。持续运行,不自动重置。

在底边附近添加一条小巧优雅的控制条,包含:

“1 BALL”
“2 BALLS”
暂停 / 继续
重置
“0.25×” 慢动作

将这些控件保持在视觉上的次要地位。它们不得与牛顿摆或其摆动路径重叠。

选择“1 BALL”或“2 BALLS”时,应重置模拟,将对应的最左侧球或双球抬升至同一释放角度,短暂保持后再释放。

重置应恢复并重放当前选中的模式。

慢动作必须缩放模拟时间,同时保持相同的物理表现。它不得改变重力、碰撞行为或悬挂几何。

允许用户在各自允许的摆动平面内将任一外侧球向外拖动,然后释放。将拖动角度限制在合理上限,约 45 度。全程保持其悬线紧绷。

添加“H”键盘快捷键,用于隐藏或显示控制条,以便干净录制。

保持体验静音。不要音乐、碰撞音效、粒子、运动拖尾、撞击闪光、说明性叠层、大标题、模型名称或装饰性文字。

交付一个完整的 HTML 文件,内联 CSS 与 JavaScript。使用同一个固定版本的 Three.js,必要时搭配相应的模块。

不设构建步骤,不使用后端、外部模型、外部贴图,也不下载 HDR。

在显示画布之前,先初始化渲染器、相机、灯光、材质与起始姿态。避免出现可见的黑色启动帧。

支持浏览器缩放而不使场景变形。目标是在普通笔记本上流畅运行,并合理限制像素密度。

完成之前,检查以下各项:

恰好五颗球始终保持可见并正确悬挂。
完整的框架与最大摆幅必须容纳在正方形构图内。
单球模式下,每次撞击大约传递一颗球。
双球模式下,每次撞击大约传递两颗球。
暂停、重置、慢动作与拖动均正常工作。
铬金属反射在运动全程保持清晰可读。
场景立即出现,且不产生任何运行时错误。

返回完整、可运行的 HTML。

溯源

原作者
ivanainai
发布日期
2026-10-09(由推文 ID 反解)
原始出处
查看原帖 ↗
收录来源
zhuyansen/awesome-opus-5.5-video · 2108625335122026542 · 未声明许可