Chapter 6 of The Nature of Code, Physics Libraries, covers physics engines, whose core method is Verlet integration: a point is advanced from its current and previous positions, so velocity is implicit and distance constraints are enforced by direct repositioning. A grid of such points joined by neighbor constraints is a cloth, implemented here directly rather than with a library.

The cloth is pinned along its full border and held under tension with no gravity, so it stays flat until struck. A week of USGS M2.5+ earthquakes is replayed in time order; each event applies an out-of-plane impulse at the grid cell matching its longitude (column) and latitude (row), scaled by magnitude and normalized to the week’s range. Thread color encodes strain, so each earthquake registers as a localized displacement that reflects off the fixed edge and settles.

Verlet integration advances a point by \(\mathbf{x}_{t+1} = 2\mathbf{x}_t - \mathbf{x}_{t-1} + \mathbf{a}\,\Delta t^2\), so velocity is implicit, \(\mathbf{v}_t \approx (\mathbf{x}_t - \mathbf{x}_{t-1})/\Delta t\). Each edge is a distance constraint relaxed toward its rest length \(L_0\) by iterated projection (Jakobsen’s position-based method), moving each free endpoint by \(\tfrac{1}{2}(d - L_0)\,\hat{\mathbf{d}}\) per pass. Strain is \(\varepsilon = (d - L_0)/L_0\), and the strike impulse scales linearly with magnitude \(M\) normalized to \([M_{\min}, M_{\max}]\).

Data source: USGS Earthquake Hazards Program
Endpoint: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_week.geojson
Access: Public, no key. Loaded from an hourly server-side refresh when possible, with a bundled snapshot fallback, and a live browser fetch only when the API allows CORS. Data window: Aug 20, 2026 - Aug 27, 2026 (pulled Aug 27, 2026 UTC)

Latest data pull 411 rows
Aug 20, 2026 - Aug 27, 2026 (pulled Aug 27, 2026 UTC)
Hours ago
Longitude
Latitude
Magnitude
2.45
-68.85
19.19
3.4
6.36
121.57
22.84
4.5
8.31
168.91
-13.95
4.5
8.43
-155.5
59.48
2.6
8.79
143.85
38.13
5.6
9.56
120.61
-8.33
4.7
9.76
120.7
-8.31
4.9
10.33
-67.06
17.97
2.6
10.73
-66.63
18.79
3.1
11.1
-150.26
61.23
2.5
11.39
-73.06
6.74
4.9
11.84
-148.88
66.49
2.7
12.34
-65.99
19.14
3.4
13.72
165.79
-11.04
4.9
13.89
121.51
-8.37
5
15.25
176.36
51.96
3.3
15.67
-65.43
17.97
3.1
17.16
-69.34
-26.16
4.3
17.18
-160
54.55
4.1
18.29
122.33
21.54
4.6
18.35
121.34
-8.33
4.6
18.44
-68.79
18.42
4
20.03
-65.44
17.94
2.9
20.17
-65.42
17.96
2.9
20.61
146.44
44.69
4.7
20.99
-64.94
18.71
3
21.23
143.66
39.73
4.8
22.4
11.68
-52.77
4.8
23.11
-119.61
36.17
2.5
23.16
-103.74
31.79
3
23.52
-150.47
60.63
2.5
24.94
176.3
51.94
3.1
25.2
-153.18
59.93
3.4
25.2
176.27
51.94
2.8
25.28
85.52
28.27
5.2
25.74
71.36
36.49
4.5
26.05
127.55
-6.62
4.5
26.34
127.49
-6.64
4.8
26.4
-156.37
20.16
2.5
26.53
-70.92
-25.52
4.2
26.62
120.29
-7.81
4.6
26.79
176.37
52.15
3.9
26.82
176.31
51.98
3.9
27.5
176.34
51.95
2.8
27.57
-165.18
53.78
2.5
27.87
78.09
31.75
4
28.18
-155.58
19.17
2.6
29.1
-125.96
40.55
2.6
30.12
-126.91
43.35
3
30.14
74.42
36.78
4.4
30.75
120.71
-8.26
4.9
30.79
176.28
51.95
3.4
31.75
141.89
37.27
4.7
31.86
-116.07
33.24
3.1
31.87
176.29
51.96
3.1
32.13
-152.86
59.52
3.4
32.13
-152.09
59.33
3.9
32.14
176.3
51.98
2.9
32.27
-155.58
20.26
2.6
32.36
-65.7
17.88
2.7
32.6
159.28
51.5
4.3
32.72
-169.4
52.31
2.5
32.78
176.31
51.97
3.1
32.88
125.81
3.69
4.2
32.9
-167.04
53.03
2.6
33.42
38.39
38.11
4.2
33.62
176.29
51.97
3
33.96
-147.52
60.31
2.6
34.4
149.68
46.25
4.3
35.21
176.31
51.99
3
35.26
-161.29
54.49
2.5
35.75
170.5
-14.23
4.5
35.79
-147.54
60.34
2.7
35.85
176.22
51.86
3.5
36.1
176.38
52.08
2.8
36.11
-150.73
63.3
3
36.88
-171.9
-17.41
5.2
37.17
120.63
-8.08
5
37.17
-163.73
52.83
2.7
37.26
-159.82
55.06
2.7
37.4
155.78
49.9
4.3
38.12
176.28
51.95
3.4
38.2
19.52
40.95
4.4
38.5
176.34
52.07
2.8
39.17
-166.98
52.36
2.5
39.62
179.35
50.17
2.9
39.66
-174.39
52.08
2.5
39.69
-91.52
14.79
4.3
39.71
167.88
-44.37
4.3
39.95
179.82
-23.35
5.5
40.65
127.33
-3.65
4.9
41.55
-160.07
54.44
2.5
42.03
-165.22
53.39
2.9
42.28
-118.74
37.41
2.6
42.33
-161.56
54.33
2.6
42.86
-104.3
31.69
2.7
43.02
145.63
43.05
5
43.26
-148.63
56.79
2.9
44.01
-176.16
51.32
3.6
44.25
-178.07
51.35
2.5
44.32
-173.89
51.49
2.6
44.77
-149.19
65.59
2.6
45.14
121.57
22.61
5.5
45.34
124.45
3.42
4.6
45.82
47.4
33.1
4.2
46.38
-23.23
63.85
4.2
48.51
-23.42
63.75
4.4
48.72
-68.18
18.84
4.1
48.92
-85.65
16.85
4.4
49.04
127.56
-6.61
4.7
49.2
-64.64
18.55
3.1
50.16
126.85
9.03
4.7
50.2
26.33
45.66
4.4
50.77
155.64
-6.97
4.5
50.83
70.46
34.46
4.9
51.06
-120.33
35.51
2.7
51.6
-177.02
51.3
2.5
52.06
120.25
-8.39
4.9
52.7
124.99
23.77
4.6
52.91
-151.48
63.16
3.1
53.27
-158
56.41
3
53.29
-107.55
35.26
2.7
55.11
152.05
-6.49
4.6
55.72
178.33
51.44
2.6
55.92
-154.31
58.97
3.9
56.46
176.33
52.03
2.9
56.52
-166.29
53.22
2.5
57.15
127.5
-6.69
5
57.31
-151.98
60.41
2.5
57.97
-160.21
54.52
2.5
58.87
-67.53
18.79
2.9
59.12
176.29
52.04
3.2
59.41
176.26
51.94
3.2
59.72
145.67
18.64
4.7
60.17
-93.39
31.84
2.6
60.43
-151.48
61.93
2.6
60.69
128.65
26.11
4.9
60.94
120.45
-7.78
4.8
61.98
127.46
-6.63
6
62.76
-118.83
37.45
2.9
63.66
-13.84
-17.7
5
64.07
176.29
51.95
3.6
64.14
-67.34
18.76
3
64.63
-157.58
57.75
2.5
64.74
-156.22
57.07
2.7
64.85
176.35
52.09
3
65.01
-151.15
58.39
2.6
65.05
-104.54
31.74
3.1
65.82
-172
-18.1
4.9
66.1
129.69
-5.05
5.5
66.49
-118.83
37.45
2.8
67.23
-119.52
38.52
2.7
67.49
-150.83
65.85
2.5
67.73
176.33
52.02
3.1
68.28
-117.84
36.07
2.7
68.53
-83.91
9.99
4.9
70.47
-176.29
-20.99
4.5
71.08
-67.15
-28.14
4.5
71.27
-67.38
18.33
2.6
72.12
-179.05
51.04
2.7
72.15
125.23
5.33
4.8
72.38
-174.43
51.72
2.5
72.5
176.31
51.98
3.2
72.58
-93.23
14.19
4.1
73.39
-14.92
-12.64
4.9
73.46
-76.84
4.52
4.4
73.82
120.47
-7.96
4.7
74.14
-151.04
58.55
3.2
74.43
-67.73
19.1
3.4
74.69
-178.18
51.16
2.5
74.93
120.49
-8.22
4.6
75.08
-150.07
56.24
2.9
75.46
-150.03
56.28
3
75.71
105.07
28.38
4.9
76.38
-166.88
52.95
2.6
76.44
178.53
51
3
76.8
176.38
52.19
5
77.03
-101.61
32.4
2.8
77.18
-66.85
-24.1
4.2
77.19
120.69
-8.04
4.7
78
-66.92
17.86
2.6
78.61
164.7
-10.69
5.3
78.61
-176.93
51.65
3.2
78.81
120.84
-8.2
5.2
79.51
-71.61
-36.74
4.5
79.56
-176.09
51.38
2.6
79.92
179.91
52
2.5
80.2
100.65
-2.07
4.4
80.23
-150.94
61.61
2.5
81.19
126.19
5.79
4.7
81.7
-127.24
43.41
2.7
81.86
-169.46
52.07
3
82.21
-66.46
-23.13
4.5
82.76
-25.26
-58.75
4.9
83.54
142.88
42.23
4.5
85.01
-164.81
53.74
2.7
85.35
177.36
51.74
3.3
85.37
176.3
51.91
3.5
86.05
155.51
-6.98
4.6
86.12
-170.42
52.15
2.7
86.4
142.83
41.83
6
86.52
-152.16
58.94
2.5
87.31
-150.8
62.9
3.1
87.73
-155.5
19.37
3.2
87.94
-162.17
54.47
2.6
88.07
-150.35
60.11
2.7
88.77
-14.85
-12.83
5.3
89.4
146.82
-6.2
4.3
89.87
-61.08
16.78
4.1
90.07
74.48
36.76
4.6
90.53
-122.95
39.5
2.8
90.86
-117.84
36.07
3.5
91.19
-67.37
18.79
3.1
91.89
-117.84
36.06
2.7
91.94
162.96
-10.9
5.2
92.13
-117.84
36.07
3.4
92.15
-117.84
36.07
4
92.21
-174.33
51.73
2.8
92.3
176.56
51.69
4
92.44
-153.49
58.06
3.8
92.78
-65.4
19.43
3.4
93.67
-166.56
53.62
2.5
94.08
-139.88
60.6
2.5
94.35
-65.34
10.67
4
94.49
-178.12
-18.35
4.6
95.05
-150.52
60.69
3.4
95.1
-150.27
61.57
3.3
95.66
-152.13
60.66
2.5
96.4
96
17.79
4.6
97.34
-174.98
50.82
2.5
97.75
-155.75
61.97
3.1
98.11
-163
53.88
2.6
98.23
-179.4
50.18
2.7
98.59
-67.68
18.99
3.3
99.27
-176.09
51.32
2.6
99.35
-120.47
35.92
2.8
99.61
141.91
36.95
4.4
101.67
-160.26
54.56
3.4
101.9
71.34
36.71
4.4
102.13
120.74
-8.12
4.5
102.25
-93.33
14.13
4.5
102.47
-66.85
17.88
2.6
102.59
-156.6
67.44
2.6
103.06
-159.92
54.57
2.6
103.08
176.39
52.02
3.7
104.08
-160.08
54.1
3.1
104.25
123.01
-0.17
4.9
104.82
176.33
52.01
4
105.21
176.35
52.04
3.4
105.37
-68.79
-22.19
4.6
105.4
128.61
28.19
4.4
105.44
176.18
51.7
3
105.83
-158.47
55.8
3
105.88
176.37
52.09
3.1
106.48
100.87
-3.03
4.5
107.11
177.12
51.62
2.6
107.14
140.08
35.94
5.8
107.43
120.6
-7.89
4.6
107.6
100.49
-3.3
4.7
109.57
176.33
52.06
3
111.13
-126.7
41.88
2.6
112.48
-178.11
51.22
2.8
113.83
-107.53
35.31
4.1
114.1
-176.61
51.86
2.5
115.03
-64.83
19.39
3.4
115.16
-68.53
18
3.3
115.66
120.7
-7.89
4.8
115.77
-47.6
-60.38
6.2
115.91
-161.35
54.43
3.1
116.28
-119
39.35
2.7
116.42
145.33
14.34
4.6
116.44
-149.67
60.91
3.9
116.48
-47.26
-60.26
5.7
116.79
-44.63
12.52
4.9
117.19
-169.67
52.19
2.6
117.42
126.74
6.74
5
117.77
-67.57
18.84
3.2
118.31
-67.77
19.04
3.7
118.36
146.72
13.9
4.9
118.39
121.46
-8.23
4.7
118.93
176.35
51.99
3.2
118.99
-163.2
53.92
2.7
119.41
125.58
9.4
5
120.27
176.23
51.8
3
120.48
122.08
24.42
4.4
122.16
120.69
-8.31
4.6
122.25
-64.78
19.51
3.7
122.56
-14.88
-12.77
5.3
122.63
120.56
-8.28
5.2
124.09
-66.32
-22.56
4.4
124.2
-149.82
56.11
2.9
125.71
-68.88
-25.57
4.7
126.15
158.35
51.92
4.4
126.23
69.67
34.62
4.1
126.25
-117.12
37.21
2.6
127.78
120.64
-7.88
4.9
128.14
-93.36
32.11
3.4
130.06
126.81
23.68
4.7
130.45
104.55
-7.58
5.7
130.71
-117.84
36.07
3.3
131.04
120.46
-7.77
4.9
131.39
-175.6
-19.69
4.6
132.06
120.27
-8.38
4.5
132.32
-105.57
-35.33
4.5
132.86
-117.84
36.06
3
133.01
142.64
28.47
4.5
133.69
179.79
-24.48
4.3
134.41
-27.63
48.03
4.6
134.62
-64.87
19.33
3.4
134.96
179.88
-24.52
4.4
135.04
-26.56
-58.85
5.4
135.42
-165.79
53.29
2.7
135.6
131.04
-3.41
4.9
135.83
-178.71
-31.94
4.9
136.11
140.38
33.72
5.4
136.22
129.89
-6.48
4.6
136.23
120.94
-8.31
4.6
136.77
179.71
51.3
3.1
136.87
120.53
-8.19
4.5
136.96
-124.23
40.56
2.6
137.1
120.54
-8.21
4.6
137.5
146.78
47.22
4.5
138.21
-160.11
54.43
3.5
138.48
-104.43
31.65
3.2
138.77
125.58
9.48
5.1
138.94
125.34
9.34
5.2
139.23
120.66
-8.36
4.5
139.64
120.52
-8.11
4.5
139.91
120.52
-7.82
4.9
139.94
-175.31
-24.71
5.1
140.22
-156.85
54.73
3.2
140.79
176.33
52.04
3.4
140.99
-109.87
41.56
3.1
142.2
23.57
-53.14
4.6
142.76
-168.26
52.36
2.6
142.78
-163.26
53.88
2.8
144.91
-163.34
53.95
4.2
145.46
-64.81
19.28
3.4
145.53
-64.86
19.42
3.7
145.6
120.51
-8.38
4.6
145.86
120.43
-8.25
4.4
146.04
33.57
41.02
4.3
146.3
-156.18
67.87
2.5
146.32
176.36
52.01
3.4
146.5
121.27
-8.28
4.6
146.67
-165.24
53.42
2.5
146.85
120.6
-8.22
4.6
146.92
176.35
52.06
3
146.95
-165.33
53.52
4.3
147.01
-176.25
51.29
3.4
147.07
-104.22
31.66
2.5
148.03
176.4
52.07
3.2
148.12
127.79
26.48
4.7
148.49
176.39
52.2
3.2
148.54
-141.45
-56.59
5
149.12
120.01
-8.05
4.4
150.03
176.34
52.02
3
150.06
-163.58
54.01
2.8
150.06
-163.83
54.11
2.6
150.19
145.62
15.97
4.5
150.31
176.33
52.01
3.1
150.44
176.31
51.93
3
150.64
-73.97
-14.95
4.4
151.75
176.27
51.9
3.4
152.25
121.33
-8.21
5
152.75
121.27
-8.42
5
153.03
176.28
51.87
3.1
153.57
176.3
51.98
2.8
153.73
153.56
-5.37
5.1
153.93
121.4
-8.29
5.6
154.14
-73.52
-14.64
6.7
154.17
-148.1
61.57
3.5
154.42
176.32
51.95
3.2
154.98
-149.09
56.78
2.7
155.58
-166.18
51.76
2.5
155.9
-136.37
59.02
3.1
157.1
-136.4
59.03
2.8
157.37
-160.59
55.29
3.7
157.62
107.81
-8.06
4.5
158.07
176.29
51.98
2.8
158.23
148.54
-1.17
4.9
158.53
-108.58
34.82
2.9
158.61
-115.25
32.21
2.7
158.96
-153.35
59.98
2.6
159.69
-178.65
-17.8
4.8
160.76
-149.22
61.19
3
160.78
-152.86
60.03
2.9
161.11
-174.9
50.35
2.7
161.25
176.3
52.01
3.6
162.01
120.87
-7.94
4.6
162.32
95.45
37.81
5.2
162.63
120.67
-8.22
5.3
163.25
120.66
-8.07
4.8
163.25
-163.5
53.45
2.6
163.61
-65.02
18.78
3
163.7
-116.51
38.44
2.6
163.72
-139.86
60.59
2.5
164.12
120.49
-8.22
5
164.23
120.38
-8.29
5
164.34
-68.86
-21.26
4.1
166.48
-150.95
63.01
3
166.52
-115.75
36.71
2.7
166.67
140.64
36.65
4.3
167.12
176.46
52.27
2.5
167.18
-168.05
52.18
2.5
167.27
-70.46
-24.42
4.7
167.32
176.29
51.99
3
167.53
-172.26
50.77
2.8
167.56
-88.78
37.06
2.5
167.59
120.39
-7.97
4.6
167.75
120.4
-8.39
4.6

All 411 earthquakes are listed below.