From 7ef812d90a050f59012b56fe9883574c20d03938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Tue, 20 Aug 2019 22:17:07 +0200 Subject: [PATCH] Animation --- README.md | 6 +++--- index.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9952cde..9ec9d27 100644 --- a/README.md +++ b/README.md @@ -2597,13 +2597,13 @@ img.convert(mode='RGB').save('test.png') # $ pip3 install imageio from PIL import Image, ImageDraw import imageio -HEIGHT, R = 126, 10 +WIDTH, R = 126, 10 frames = [] for velocity in range(15): y = sum(range(velocity+1)) - frame = Image.new('L', (HEIGHT, HEIGHT)) + frame = Image.new('L', (WIDTH, WIDTH)) draw = ImageDraw.Draw(frame) - draw.ellipse((HEIGHT/2-R, y, HEIGHT/2+R, y+2*R), fill='white') + draw.ellipse((WIDTH/2-R, y, WIDTH/2+R, y+2*R), fill='white') frames.append(frame) frames += reversed(frames[1:-1]) imageio.mimsave('test.gif', frames, duration=0.03) diff --git a/index.html b/index.html index 00de1a2..20e2966 100644 --- a/index.html +++ b/index.html @@ -2208,13 +2208,13 @@ img.convert(mode='RGB').save(Animation

Creates a GIF of a bouncing ball:

# $ pip3 install imageio
 from PIL import Image, ImageDraw
 import imageio
-HEIGHT, R = 126, 10
+WIDTH, R = 126, 10
 frames = []
 for velocity in range(15):
     y = sum(range(velocity+1))
-    frame = Image.new('L', (HEIGHT, HEIGHT))
+    frame = Image.new('L', (WIDTH, WIDTH))
     draw  = ImageDraw.Draw(frame)
-    draw.ellipse((HEIGHT/2-R, y, HEIGHT/2+R, y+2*R), fill='white')
+    draw.ellipse((WIDTH/2-R, y, WIDTH/2+R, y+2*R), fill='white')
     frames.append(frame)
 frames += reversed(frames[1:-1])
 imageio.mimsave('test.gif', frames, duration=0.03)