Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2856383

Browse files
committed
FIX: typos
1 parent 72b7bed commit 2856383

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/animation/rain.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,35 @@
2121
('growth', float, 1),
2222
('color', float, 4)])
2323

24-
# Scatter plot is used to animated rain drops
24+
# Scatter plot is used to animate rain drops
2525
scat = ax.scatter(P['position'][:,0], P['position'][:,1], P['size'], lw=0.5,
2626
animated=True, edgecolors = P['color'], facecolors='None')
2727
ax.set_xlim(0,1), ax.set_xticks([])
2828
ax.set_ylim(0,1), ax.set_yticks([])
2929

3030

3131
def update(frame):
32-
i = frame % 50
32+
i = frame % len(P)
3333

3434
# Make all colors more transparent
3535
P['color'][:,3] = np.maximum(0, P['color'][:,3] - 1.0/len(P))
36+
3637
# Make all circles bigger
3738
P['size'] += P['growth']
3839

3940
# Pick a new position for oldest rain drop
4041
P['position'][i] = np.random.uniform(0,1,2)
42+
4143
# Reset size
4244
P['size'][i] = 5
45+
4346
# Reset color
4447
P['color'][i] = 0,0,0,1
48+
4549
# Choose a random growth factor
4650
P['growth'][i] = np.random.uniform(50,200)
4751

48-
# Update scatter plots
52+
# Update scatter plot
4953
scat.set_edgecolors(P['color'])
5054
scat.set_sizes(P['size'])
5155
scat.set_offsets(P['position'])

0 commit comments

Comments
 (0)