Einfache Animation
Abschlussbedingungen
import random
import pgzrun, pygame
WIDTH, HEIGHT = 500, 500
rechteck = Rect((WIDTH/2, HEIGHT/2), (20, 20))
def update():
pass
def draw():
screen.fill("white")
screen.draw.filled_rect(rechteck, "red")
def on_mouse_down():
mausposition = pygame.mouse.get_pos()
animate(rechteck,
center=mausposition,
# probiere hier auch: 'accelerate', 'decelerate', 'bounce_end'
tween='linear',
duration=1)
pgzrun.go( )
Zuletzt geändert: Donnerstag, 3. April 2025, 14:24