Fruitydelicious Animations - (11.02.2023)
# Bounce off edges if x < 0 or x > 10: vx *= -1 if y < 0 or y > 10: vy *= -1
def animate(i): global vx, vy # Update fruit position x, y = fruit.get_data() x += vx y += vy Fruitydelicious animations (11.02.2023)
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # Bounce off edges if x < 0
plt.show() This animation showcases a variety of fruits growing and changing sizes. 0 or x >
fig, ax = plt.subplots()
# Movement variables vx, vy = 2, 2