The heart, inside out
A beating human heart in 3D: blood flow, a cross-section, the chambers opened up, the electrical system and how it all changes from sleep to sprint.
Made in Claude Code (Claude subscription) with claude-opus-5.5. The agent wrote code, looked at the preview and fixed it over several iterations. This is not a single-shot result: comparisons on this site show models in one attempt.
Starting prompt
Build "The heart, inside out": an interactive anatomical animation of the living human heart. It shows how the heart is built and how it works, not just its outside. Single self-contained HTML file; Three.js and its addons from a CDN via an import map are fine; build everything procedurally, no external textures or models. The heart (in its anatomical position: apex pointing down and to the patient's left, right ventricle in front): - An organic, muscular, beating heart with the coronary arteries and veins on its surface. - The great vessels: - the aorta with its arch and branches; - the pulmonary trunk splitting into the pulmonary arteries; - the superior and inferior vena cava; - four pulmonary veins. Deoxygenated vessels are blue and oxygenated ones red, as in an anatomy atlas. - Inside: four chambers with realistic wall thickness (the left ventricle the thickest), the septum, papillary muscles with chordae tendineae, and the four valves (tricuspid, pulmonary, mitral, aortic). The valve leaflets open and close in time with the beat. - The conduction system: sinoatrial node, atrioventricular node, bundle of His, left and right bundle branches, Purkinje fibres. - A physiologically timed cardiac cycle at an adjustable heart rate: the atria contract first, then the ventricles, with the valves opening and closing in the correct order. An automatic cinematic tour of six chapters, about 75 seconds, then it loops. Each chapter has its own camera work, a title and one line of explanation. 1. Overview: the beating heart floating in a soft studio space, slow camera move. 2. Blood flow: the muscle turns translucent and blood flows as particles that move with the beat. - Blue blood enters the right atrium from the venae cavae, passes the tricuspid valve into the right ventricle and leaves through the pulmonary valve towards the lungs. - Red blood returns through the pulmonary veins, passes the mitral valve and is ejected through the aortic valve into the aorta. 3. Section: a cutting plane travels through the heart to a four-chamber view. The cut reads as solid muscle around the cavities, with the septum, papillary muscles and valves in cross-section. 4. Opened up: the heart splits into front and back halves like an anatomy model. The four valves lift out into the valve plane, and the great vessels, the coronary tree and the pericardium separate. Every part is labelled, then it all reassembles. 5. Electrical: the impulse fires in the sinoatrial node and spreads across the atria as a glowing wave. It pauses at the atrioventricular node, races down the bundle of His and the bundle branches into the Purkinje fibres, and the ventricles depolarise from the apex up. A live ECG traces the P wave, QRS complex and T wave in sync. 6. Exercise: the heart rate climbs from rest to a sprint and recovers. The beat, valves, flow and ECG all speed up, with readouts of heart rate, blood pressure, stroke volume and cardiac output. Interface (a clean, light medical-atlas style): - Chapter tabs. - Heart-rate presets: sleep, rest, walk, sprint. - Sliders for explode amount, section position and heart rate. - The readout and a scrolling ECG strip. - A labels toggle and two or three display themes. - A play/pause control with chapter progress. - Drag to orbit and scroll to zoom. The camera returns to the cinematic path a few seconds after the last input. Using a tab, preset or slider pauses the tour until play is pressed. - Everything starts automatically and is visibly moving from the first frame. The layout works on a phone. Anatomy and timing must be correct, and labels use the names found in an anatomy atlas. Rendering: soft studio lighting with shadows, physically based wet-muscle materials with a subtle sheen, ACES tone mapping. Bloom only on the electrical impulse. The frame must stay clean and readable, never washed out by glare or haze. Engineering rules (the page must work on the first load, with no fixes): - Use Three.js r170 and only methods that exist on each of its classes. Give every custom ShaderMaterial `fog: false`, and declare every uniform, constant and varying its shaders use. - Declare each identifier once. Inside one calculation, never reuse a shared scratch vector for two values that are both still needed; use local vectors. - Guard every animated value against NaN. - Answer with the complete file exactly once, in a single ```html code block: no drafts, partial snippets or notes. Keep planning brief and write the code. Aim for roughly 800 to 1,200 lines, compact and well structured. No black, untextured or placeholder objects anywhere.