The imagiCharm isn't just an accessory - the more coding you learn, the more useful programs you can write to run on your imagiCharm! Today, we are turning the imagiCharm into a countdown clock! In the example code the function takes 4 parameters: the amount of time you have in minutes, number of activities you want to do (what number to start counting down from), color of the numbers displayed, background color.
Your challenge for #day11 is to create your version of the countdown clock! Maybe you would like to add a different transition between the numbers, use a different logic, have more or fewer parameters!
an = Animation()
def background(color):
for i in range(8):
for j in range(8):
m[i][j] = color
def countdown(time, nr_a, col,b_col):
a_len = time * 60 / nr_a * 1000
numbers = []
for i in range(0, nr_a):
numbers.append(nr_a - i)
for i in numbers:
background(b_col)
character(str(i), col)
an.add_frame(m, int(a_len))
clear()
countdown(0.05, 5, R, B)
https://www.youtube.com/watch?v=IyqwMrV8E00&feature=youtu.be