Are you sure?
Do you want to delete “Through the tunnel” permanently? You will not be able to undo this action.
circles = []
def getColorForWidth(width):
decColor = (150 - width) // 10
hexColor = hex(decColor)[2:]
colorString = '#' + hexColor + hexColor + hexColor
return colorString
def createCircle(x):
return Circle(width = 0, height = 0, color = getColorForWidth(0), x = x)
def advanceSingleCircle(circle):
currentWidth = circle.width
newWidth = int(currentWidth + 10)
circle.width = newWidth
circle.height = newWidth
circle.color = getColorForWidth(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(i))
circles.append(createCircle(30))
for i in range(30):
advanceCircles()
circles.append(createCircle(30))
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)