from icons import Circle
import math
Rectangle(color='white')
Circle(width=100, height=100, color='mediumspringgreen')
Circle(width=60, height=60, color='deepskyblue')
Circle(width=20, height=20, color='mediumspringgreen')
Circle(width=5, height=5, color='lemonchiffon')
# outer moving circle
r1 = 40
cir1 = Circle(width=20, height=20, color='orangered')
cir1.x = 50
cir1.y = 90
dot1 = Circle(width=5, height=5, color='lemonchiffon')
dot1.x = 50
dot1.y = 90
# inner moving circle
r2 = 20
cir2 = Circle(width=20, height=20, color='orangered')
cir2.x = 50
cir2.y = 30
dot2 = Circle(width=5, height=5, color='lemonchiffon')
dot2.x = 50
dot2.y = 30

for i in range(0, 360, 5):
    with animation(duration = .2):
        angle1 = i * math.pi / 180
        cir1.x = 50 + r1 * math.sin(angle1)
        cir1.y = 50 + r1 * math.cos(angle1)
        dot1.x = 50 + r1 * math.sin(angle1)
        dot1.y = 50 + r1 * math.cos(angle1)
        
        angle2 = (i + 180) * math.pi / 180
        cir2.x = 50 + r2 * math.sin(angle2)
        cir2.y = 50 + r2 * math.cos(angle2)
        dot2.x = 50 + r2 * math.sin(angle2)
        dot2.y = 50 + r2 * math.cos(angle2)

rotating circles

by carl

Created 5 years, 11 months ago.