from kandinsky import * from math import sin, pi, cos WIDTH = 320 HEIGHT = 222 rect_width = 20 rect_height = 20 rect_color = color(255, 0, 0) amplitude = 40 frequency = 0.02 x = WIDTH - rect_width y = HEIGHT - rect_height while x >= -rect_width and y >= -rect_height: fill_rect(0, 0, WIDTH, HEIGHT, color(255, 255, 255)) y = int(HEIGHT / 2 + amplitude * sin(2 * pi * frequency * (WIDTH - x) / WIDTH)) fill_rect(x, y, rect_width, rect_height, rect_color) # Add circular movement circular_radius = 10 # Adjust this for the size of the circular movement circular_speed = 0.03 # Adjust this for the speed of the circular movement circular_x = x + int(circular_radius * cos(circular_speed * x)) circular_y = y + int(circular_radius * sin(circular_speed * x)) fill_rect(circular_x, circular_y, rect_width, rect_height, color(0, 0, 255)) # Blue circle x -= 1 y -= 3