from random import randint
circles = []

def getColor():
    decColor1 = (randint(0,15)*10) // 10
    hexColor1 = hex(decColor1)[2:]
    decColor2 = (randint(0,15)*10) // 10
    hexColor2 = hex(decColor2)[2:]
    decColor3 = (randint(0,15)*10) // 10
    hexColor3 = hex(decColor3)[2:]
    colorString = '#' + hexColor1 + hexColor2 + hexColor3
    return colorString

def createCircle(x, y):
    return Circle(width = 0, height = 0, color = getColor(), x = x, y = y)

def advanceSingleCircle(circle):
    currentWidth = circle.width
    newWidth = int(currentWidth + 10)
    circle.width = newWidth
    circle.height = newWidth

def advanceCircles():
	for circle in circles:
    	advanceSingleCircle(circle)	
    
	if len(circles) > 20: circles.pop(0) # ideally we should destroy the popped circle
        
def animationIteration(i):
    with animation(duration = 0.15):        
        advanceCircles()
    
    circles.append(createCircle(randint(0,150), randint(0,150)))
    
circles.append(createCircle(randint(0,150), randint(0,150)))
        
for i in range(30):
	advanceCircles()    
	circles.append(createCircle(randint(0,150), randint(0,150)))

for i in range(30, 70, 2):
    animationIteration(i)
    
for i in range(15):
    animationIteration(70)
    
for i in range(70, 30, -2):
    animationIteration(i)
    
for i in range(15):
    animationIteration(30)

Color Circles

by alex48

Created 4 years, 11 months ago.
Based on Through the tunnel by lurker0032.