-
Notifications
You must be signed in to change notification settings - Fork 1
/
Circular_loading_animation.py
41 lines (40 loc) · 2.41 KB
/
Circular_loading_animation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import flet as ft
import time
def main(page: ft.Page):
def animate(i,j):
global bubble1, bubble2, bubble3, bubble4, bubble5, bubble6, bubble7, bubble8, bubble9
time.sleep(0.1);
exec(f"bubble{i}.width=20;")
exec(f"bubble{i}.height=20;")
exec(f"bubble{j}.width=25;")
exec(f"bubble{j}.height=25;")
page.update();
page.horizontal_alignment="center";
page.vertical_alignment="center";
def change():
start=-1;
while(True):
li=[1,3,5,7,8,6,4,2]
for i in range(len(li)):
if (i==0):
animate(2,1);
else:
animate(li[i-1],li[i]);
global bubble1, bubble2, bubble3, bubble4, bubble5, bubble6, bubble7, bubble8, bubble9
bubble1=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble2=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble3=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble4=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble5=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble6=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble7=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
bubble8=ft.Container(animate=ft.animation.Animation(10, "linear"),width=20,height=20, border_radius=100,bgcolor="#B932FD");
loading=ft.Column(controls=[ft.Column(spacing=-1,controls=[ft.Row(alignment="center",controls=[bubble1]),
ft.Row(alignment="center",controls=[bubble2,ft.Text(" "),bubble3])]),
ft.Row(alignment="center",controls=[bubble4,ft.Text(" "),bubble5]),
ft.Column(spacing=-1,controls=[ft.Row(alignment="center",controls=[bubble6,ft.Text(" "),bubble7]),
ft.Row(alignment="center",controls=[bubble8])])
]);
page.add(loading);
change();
ft.app(target=main)