여러 공이나 상자가 중력으로 떨어져 서로 부딪히고 튕기며 바닥에 쌓이는 물리 낙하Many balls or boxes fall under gravity, collide, bounce and pile up on the floor.
반경 12px 공 30개가 4초 동안 위에서 쏟아져 바닥에서 반발 0.6으로 튀고 서로 밀치며 아래에 쌓인다
공이 서로 통과하거나 바닥에서 계속 떨려 멈추지 않고, 난수를 매번 바꿔 캡처마다 배치가 달라진다
기본값은 클립에 쓴 값Defaults are the values used in the clip
| 항목PARAM | 기본DEFAULT | 범위RANGE | 메모NOTE |
|---|---|---|---|
| 지속 | 4s | 3~6s | 낙하부터 정지까지 |
| 개수 | 30 | 15~60 | 시드로 고정 |
| 반경 | 12px | 8~20px | 1920px 기준 |
| 중력 | 600px/s2 | 400~900 | 아래 방향 |
| 반발계수 | 0.6 | 0.4~0.75 | 바닥·벽·서로 |
// 고정 스텝 시뮬레이션을 미리 계산해 프레임 표로 저장한다
function sim(seed) { const dt = 1/60, b = init(seed); const frames = [];
for (let f = 0; f < 240; f++) { step(b, dt, 600, 0.6); frames.push(b.map(o => [o.x, o.y])); } return frames; }
const F = sim(7), u = { f: 0 };
tl.to(u, { f: 239, duration: 4, ease: 'none', onUpdate: () => draw(F[Math.round(u.f)]) }, 0);그대로 붙여 넣는다Paste as is
<대상> 화면에 강체 낙하 효과를 넣어줘. 반경 12px 원 30개를 시드 7로 고정한 위치에서 위쪽 화면 밖에 두고, 중력 600px/s2, 반발계수 0.6으로 4초 동안 떨어져 바닥과 서로 부딪히게 해. 고정 스텝 1/60초로 미리 계산해 프레임 표로 저장하고 타임라인이 인덱스만 재생하게 해. Math.random은 시드 난수로 대체해.
Add a rigid-body cascade to <target>. Place 30 circles of radius 12px above the frame from fixed seed 7 and let them fall for 4 seconds with gravity 600px/s2 and restitution 0.6, colliding with the floor and each other. Precompute at a fixed 1/60 s step into a frame table and let the timeline only play back the index. Replace Math.random with a seeded PRNG.
<파일>에 원 충돌 시뮬레이션을 추가해. 고정 dt=1/60, 240프레임을 시드 7 난수로 사전 계산해 F[]에 저장하고 GSAP은 f를 0→239로 4초 선형 tween한다. 0.5초·2초·3.8초 캡처로 공이 겹치지 않고 마지막 프레임에서 정지해 있는지 확인해. 두 번 실행해 같은 프레임이 나오는지도 비교해.
Add a circle collision simulation to <file>. Precompute 240 frames at fixed dt=1/60 with a seed-7 PRNG into F[], then tween f from 0 to 239 over 4 s linear with GSAP. Capture 0.5 s, 2 s and 3.8 s to check no circles overlap and the last frame is at rest. Run twice and confirm identical frames.
HyperFrames · ReelForge · Scrolline
개념 출처와 라이선스. 구현은 이 레포에서 새로 씀Concept sources and licenses. Implementations are original to this repo