Fruitydelicious Animations (11.02.2023) Apr 2026

fig, ax = plt.subplots()

# Fruit (apple) properties fruit, = ax.plot(5, 5, 'ro') Fruitydelicious animations (11.02.2023)

import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation fig, ax = plt

def animate(i): ax.clear() ax.set_xlim(0, 10) ax.set_ylim(0, 10) for fruit in fruits: fruit['size'] += 0.1 # Grow the fruits ax.add_patch(plt.Circle((fruit['x'], fruit['y']), fruit['size'], color=fruit['color'])) 0 or x &gt

# Bounce off edges if x < 0 or x > 10: vx *= -1 if y < 0 or y > 10: vy *= -1

fruit.set_data(x, y) return fruit,

# Initialize the plot ax.set_xlim(0, 10) ax.set_ylim(0, 10)

Diese Seite verwendet Cookies, um die Nutzerfreundlichkeit zu verbessern. Mit der weiteren Verwendung stimmst du dem zu.

Datenschutzerklärung
Nach oben scrollen