corp0

Untitled

Nov 29th, 2022
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.32 KB | None | 0 0
  1. def main():
  2.     timezone = "America/Santiago"
  3.     now = time.now().in_location(timezone)
  4.     return render.Root(
  5.         child=render.Column(
  6.             children=[
  7.                 render.Row(
  8.                     cross_align="center",
  9.                     main_align="space_between",
  10.                     children=[
  11.                         get_time(now),
  12.                         laughing(),
  13.                     ],
  14.                 ),
  15.             ],
  16.         )
  17.     )
  18. def laughing():
  19.     return animation.Transformation(
  20.         child=render.Image(src=base64.decode(WHITE), height=32),
  21.         duration=60,
  22.         direction="alternate",
  23.         fill_mode="forwards",
  24.         keyframes=[
  25.             animation.Keyframe(
  26.                 percentage=0.0,
  27.                 transforms=[animation.Rotate(-360)],
  28.                 curve="ease_in_out",
  29.             )
  30.         ],
  31.     )
  32. def get_time(now):
  33.     return render.Padding(
  34.         pad=(2, 0, 2, 0),
  35.         child=render.Animation(
  36.             children=[
  37.                 render.Text(
  38.                     content=now.format("15:04"),
  39.                     font="CG-pixel-4x5-mono",
  40.                 ),
  41.                 render.Text(
  42.                     content=now.format("15:04"),
  43.                     font="CG-pixel-4x5-mono",
  44.                 ),
  45.             ]
  46.         ),
  47.     )
Add Comment
Please, Sign In to add comment